-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use
en-GB
as the new default locale – backwards compatibility …
…should be given.
- Loading branch information
1 parent
f418815
commit 0501b9a
Showing
24 changed files
with
255 additions
and
191 deletions.
There are no files selected for viewing
52 changes: 31 additions & 21 deletions
52
packages/dnb-design-system-portal/src/core/ChangeLocale.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,46 @@ | ||
import React from 'react' | ||
import { ToggleButton } from 'dnb-ui-lib/src' | ||
// import { Dropdown } from 'dnb-ui-lib/src' | ||
// import { ToggleButton } from 'dnb-ui-lib/src' | ||
import { Dropdown } from 'dnb-ui-lib/src' | ||
|
||
import Context from 'dnb-ui-lib/src/shared/Context' | ||
import { setLang } from './portalProviders' | ||
|
||
export default function ChangeLocale(props) { | ||
export default function ChangeLocale({ showUS, ...props }) { | ||
const { locale, setLocale } = React.useContext(Context) | ||
|
||
return ( | ||
<ToggleButton.Group | ||
value={locale} | ||
on_change={({ value }) => { | ||
setLocale(value) | ||
setLang(value) | ||
}} | ||
{...props} | ||
> | ||
<ToggleButton value="nb-NO">Norsk</ToggleButton> | ||
<ToggleButton value="en-US">English</ToggleButton> | ||
</ToggleButton.Group> | ||
) | ||
|
||
// return ( | ||
// <Dropdown | ||
// <ToggleButton.Group | ||
// value={locale} | ||
// data={{ 'en-US': 'English', 'nb-NO': 'Norsk' }} | ||
// on_change={({ data: { value } }) => { | ||
// on_change={({ value }) => { | ||
// setLocale(value) | ||
// setLang(value) | ||
// }} | ||
// {...props} | ||
// /> | ||
// > | ||
// <ToggleButton value="nb-NO">Norsk</ToggleButton> | ||
// <ToggleButton value="en-GB">English</ToggleButton> | ||
// <ToggleButton value="en-US">English (US)</ToggleButton> | ||
// {/* <ToggleButton value="de-DE">DE</ToggleButton> */} | ||
// </ToggleButton.Group> | ||
// ) | ||
|
||
const date = { | ||
'nb-NO': 'Norsk', | ||
'en-GB': 'English (GB)' | ||
} | ||
if (showUS) { | ||
date['en-US'] = 'English (US)' | ||
} | ||
|
||
return ( | ||
<Dropdown | ||
value={locale} | ||
data={date} | ||
on_change={({ data: { value } }) => { | ||
setLocale(value) | ||
setLang(value) | ||
}} | ||
{...props} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.