Our dictionary handles common translations like Close
in components.
Find our dictionary at: @kiwicom/orbit-components/lib/data/dictionary/...
The files contain our own translations.
Example
You can use dictionaries with various components.
import en_GB from "@kiwicom/orbit-components/lib/data/dictionary/en-GB.json";import cs_CZ from "@kiwicom/orbit-components/lib/data/dictionary/cs-CZ.json";import Pagination from "@kiwicom/orbit-components/lib/Pagination";import OrbitProvider from "@kiwicom/orbit-components/lib/OrbitProvider";import defaultTheme from "@kiwicom/orbit-components/lib/defaultTheme";const App = () => (<OrbitProvider theme={defaultTheme} dictionary={en_GB}><Pagination pageCount={4} selectedPage={3} hideLabels={false} /></OrbitProvider><OrbitProvider theme={defaultTheme} dictionary={cs_CZ}><Pagination pageCount={4} selectedPage={3} hideLabels={false} /></OrbitProvider>);
It’s also possible to use them with Translate components and useTranslate hooks for your functional components.
Fallbacks
- If a translation key doesn’t exist in your language,
the fallback is
en_GB
, which is our default language. - If a translation key doesn’t exist in either file (your language, the default language),
the translation key is rendered (for example,
button_close
).
Your own dictionary
You can add your own dictionary. Just pass an object containing keys and values.
import OrbitProvider from "@kiwicom/orbit-components/lib/OrbitProvider";const App = () => (<OrbitProviderdictionary={{button_close: "My own translation",}}><Button type="secondary" size="large" /></OrbitProvider>);
Languages
We store all inner strings we translate inside of our GitHub repository and export them to npm.