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 e3394f5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
21 changes: 10 additions & 11 deletions documentation-site/pages/getting-started/internationalization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,26 @@ This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
-->

import ReactJson from 'react-json-view'

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;

# 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={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 e3394f5

Please sign in to comment.