-
Notifications
You must be signed in to change notification settings - Fork 831
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Gergely Nemeth
committed
Feb 25, 2019
1 parent
0f85405
commit 6fc3237
Showing
6 changed files
with
149 additions
and
51 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
documentation-site/pages/getting-started/internationalization.mdx
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!-- | ||
Copyright (c) 2018 Uber Technologies, Inc. | ||
|
||
This source code is licensed under the MIT license found in the | ||
LICENSE file in the root directory of this source tree. | ||
--> | ||
|
||
import Layout from '../../components/layout'; | ||
|
||
export default Layout; | ||
|
||
# Internationalization | ||
|
||
Base UI supports English as the default language. Following the instructions below, you | ||
can use other languages too. | ||
|
||
```javascript | ||
import { LocaleProvider } from 'baseui'; | ||
import {huHU} from '{YOUR_PROJECT}/hu.json'; | ||
import App from '{YOUR_PROJECT}/app.js'; | ||
|
||
return ( | ||
<LocaleProvider locale={frFR}> | ||
<App /> | ||
</LocaleProvider> | ||
); | ||
``` | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
Copyright (c) 2018 Uber Technologies, Inc. | ||
This source code is licensed under the MIT license found in the | ||
LICENSE file in the root directory of this source tree. | ||
*/ | ||
// @flow | ||
|
||
const en_US = { | ||
datepicker: { | ||
ariaLabel: 'Select a date', | ||
}, | ||
}; | ||
|
||
export default en_US; |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
Copyright (c) 2018 Uber Technologies, Inc. | ||
This source code is licensed under the MIT license found in the | ||
LICENSE file in the root directory of this source tree. | ||
*/ | ||
// @flow | ||
import * as React from 'react'; | ||
|
||
import type {LocaleT} from './types.js'; | ||
import en_US from './en_US.js'; | ||
|
||
export const LocaleContext: React.Context<LocaleT> = React.createContext(en_US); | ||
|
||
const LocaleProvider = (props: {locale: LocaleT, children: ?React.Node}) => { | ||
const {locale, children} = props; | ||
return ( | ||
<LocaleContext.Provider value={locale}>{children}</LocaleContext.Provider> | ||
); | ||
}; | ||
|
||
export default LocaleProvider; |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
Copyright (c) 2018 Uber Technologies, Inc. | ||
This source code is licensed under the MIT license found in the | ||
LICENSE file in the root directory of this source tree. | ||
*/ | ||
// @flow | ||
|
||
export type DatepickerLocaleT = { | ||
ariaLabel: string, | ||
}; | ||
|
||
export type LocaleT = {| | ||
datepicker: DatepickerLocaleT, | ||
|}; |