forked from uber/baseweb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(i18n): add i18n support (uber#951)
- Loading branch information
1 parent
a092bd7
commit dcaeefb
Showing
41 changed files
with
860 additions
and
432 deletions.
There are no files selected for viewing
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,19 @@ | ||
/* | ||
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 Code from './code.js'; | ||
|
||
type PropsT = { | ||
src: string, | ||
}; | ||
|
||
const JSONViewer = (props: PropsT) => ( | ||
<Code language="javascript">{JSON.stringify(props.src, null, 2)}</Code> | ||
); | ||
|
||
export default JSONViewer; |
31 changes: 31 additions & 0 deletions
31
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,31 @@ | ||
<!-- | ||
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 Example from '../../components/example'; | ||
import Layout from '../../components/layout'; | ||
import JSON from '../../components/json'; | ||
import en_US from 'baseui/locale/en_US.js'; | ||
|
||
import InternationalizationExample from 'examples/internationalization/example.js'; | ||
|
||
export default Layout; | ||
|
||
# Internationalization | ||
|
||
Base UI supports English as the default language. Following the instructions below, you | ||
can use other languages too. | ||
|
||
<Example title="Internationalization example" path="examples/internationalization/example.js"> | ||
<InternationalizationExample /> | ||
</Example> | ||
|
||
## The shape of the locale file | ||
|
||
<JSON src={en_US} /> | ||
|
||
If you'd like to contribute a locale, please send a Pull Request based | ||
on the [en_US](https://github.com/uber-web/baseui/tree/master/src/locale) locale. |
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
17 changes: 17 additions & 0 deletions
17
documentation-site/static/examples/internationalization/example.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import {LocaleProvider} from 'baseui'; | ||
import {StatefulPagination} from 'baseui/pagination'; | ||
|
||
const localeOverrideHu = { | ||
pagination: { | ||
next: 'Következő', | ||
prev: 'Előző', | ||
preposition: ' ', | ||
}, | ||
}; | ||
|
||
export default () => ( | ||
<LocaleProvider locale={localeOverrideHu}> | ||
<StatefulPagination numPages={10} /> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
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 AccordionLocaleT = {| | ||
collapse: string, | ||
expand: string, | ||
|}; | ||
|
||
const locale = { | ||
collapse: 'Collapse', | ||
expand: 'Expand', | ||
}; | ||
|
||
export default locale; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
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 BreadcrumbLocaleT = {| | ||
ariaLabel: string, | ||
|}; | ||
|
||
const locale = { | ||
ariaLabel: 'Breadcrumbs navigation', | ||
}; | ||
|
||
export default locale; |
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.