-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Release i18n support #3429
✨ Release i18n support #3429
Conversation
🦋 Changeset detectedLatest commit: 4264036 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Storybook demo / Chromatic📝 Endringer til review: 1e15fe101f | 91 komponenter | 135 stories |
.changeset/funny-insects-fly.md
Outdated
"@navikt/ds-react": minor | ||
--- | ||
|
||
:sparkles: i18n support for all components. ([Docs](https://aksel.nav.no/komponenter/core/provider#84d7ea5ec517)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:sparkles: i18n support for all components. ([Docs](https://aksel.nav.no/komponenter/core/provider#84d7ea5ec517)) | |
i18n: :sparkles: Implemented i18n support for all components. Components comes with support for nb, nn and en locales ([Docs](https://aksel.nav.no/komponenter/core/provider#84d7ea5ec517)) |
|
||
/** | ||
* @private | ||
* Temporary for backwards compatibility with locale prop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For temp-comments, it could be nice to have a small comment describing the requirements for it being removed or "not" temporarily anymore if that makes sense 🤔
@navikt/core/react/src/index.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think it would be nice if to access the locales, you have to import from @navikt/ds-react/locales
and not directly on "root" @navikt/ds-react
. Just have to add this to "package.json" (i think). We then avoid "polluting" the root export with "non"-components
"./locales": {
"import": {
"types": "./esm/util/i18n/locales/index.d.ts",
"default": "./esm/util/i18n/locales/index.js"
},
"require": {
"types": "./cjs/util/i18n/locales/index.d.ts",
"default": "./cjs/util/i18n/locales/index.js"
}
},
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could even take it further and have to import from import enLocale from "@navikt/ds-react/locales/en"
and just get a default export 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would that require an entry in package.json for each locale?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes to properly scope it to each locale they would all require an entry. I think this technically works, but risks exposing other things in the dir, so one entry per locale would be the safest here.
"./locales/*": "./[path]/*"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets go for the first variant then 🚀
} | ||
} & ( | ||
| { | ||
/** Locale provided by Aksel */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could link to docs here, or show jsdoc-example with import+use
Co-authored-by: Ken <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Update docs for Provider.
Description
Sorry for the size of this PR 🙈
useI18n()
according to changes in API.removeLabel
.translations
prop and deprecatedlocale
prop.clearButtonLabel
.i18n
.axisLabelTemplates
.close
in Modal and DatePicker and put it under theglobal
key.@navikt/ds-react
Component Checklist 📝
@navikt/core/css/config/_mappings.js
)@navikt/core/css/tokens.json
)@navikt/aksel-stylelint/src/deprecations.ts
)@navikt/core/react/src/index.ts
and@navikt/core/react/package.json
)@navikt/core/css/index.css
)<Component>: <gitmoji?> <Text>.
E.g. "Button: ✨ Add feature xyz.")