Skip to content

Commit

Permalink
docs(i18n): add example
Browse files Browse the repository at this point in the history
  • Loading branch information
Gergely Nemeth committed Feb 27, 2019
1 parent 6ef7e2e commit a040d5f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
18 changes: 6 additions & 12 deletions documentation-site/pages/getting-started/internationalization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ 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 en_US from '../../../src/locale/en_US.js'

import InternationalizationExample from 'examples/internationalization/example.js';

export default Layout;

Expand All @@ -15,17 +17,9 @@ export default Layout;
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={huHU}>
<App />
</LocaleProvider>
);
```
<Example title="Internationalization example" path="examples/internationalization/example.js">
<InternationalizationExample />
</Example>

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.
17 changes: 17 additions & 0 deletions documentation-site/static/examples/internationalization/example.js
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>
);

0 comments on commit a040d5f

Please sign in to comment.