YannLynn 806d75fc79 feat: add 34+ i18n language (#3018) há 2 meses atrás
..
_story 806d75fc79 feat: add 34+ i18n language (#3018) há 2 meses atrás
source 806d75fc79 feat: add 34+ i18n language (#3018) há 2 meses atrás
README.md 076be4564e Merge branch origin/main into main há 2 anos atrás
context.tsx f76bd5879d feat: init há 4 anos atrás
interface.ts 66d1be95fd Feat dialogue (#2997) há 2 meses atrás
localeConsumer.tsx 23e87e4dbc feat: inputnumber add currency support (#2742) há 10 meses atrás
localeProvider.tsx bd83d1f9cd chore: format code há 3 anos atrás

README.md

Name

Semi Design locale package

Description

Component multilingual support

Usage

import en_GB from '@douyinfe/semi-ui/lib/es/locale/source/en_GB';
import { LocaleProvider } from '@douyinfe/semi-ui';

return (
    <LocaleProvider locale={en_GB}>
        <App/>
    </LocaleProvider>
);

How to add a language package

  1. Create a language file, add it to source directory(semi-ui/packages/semi-ui/locale/source)

  1. Translation component built-in text

  1. In order to let users know that there is this language package, you need to:
    • Add it to the LocaleProvider page to let users know that there is this new language package
    • Import this new language file to demo scope so that demo can support it

Notice: Don't replace key in ${} which is a dynamic value.

What the language file should include

  • code: language package code
  • dateFnsLocale: need to pass date-fns locale object when formatting a date (using dateFns.format or dateFns.parse etc)
  • text: components' built-in text

License

MIT