代强 bd83d1f9cd chore: format code 3 年之前
..
_story d7ce8db958 test: update storybook filename (#1161) 3 年之前
source 45ebfb4064 feat: locale ro 3 年之前
README.md f76bd5879d feat: init 4 年之前
context.tsx f76bd5879d feat: init 4 年之前
index-en-US.md f76bd5879d feat: init 4 年之前
index.md f76bd5879d feat: init 4 年之前
interface.ts bd83d1f9cd chore: format code 3 年之前
localeConsumer.tsx bd83d1f9cd chore: format code 3 年之前
localeProvider.tsx bd83d1f9cd chore: format code 3 年之前

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

UI


Semi Teams

License

MIT