Skip to content

Latest commit

 

History

History
42 lines (34 loc) · 1.28 KB

i18n.md

File metadata and controls

42 lines (34 loc) · 1.28 KB

Internationalization and localization

Thanks for contributing this project.

  1. Open Crowdin to start translating. If your language not show up, create an issue to add it.
  2. Read Corwdin documentation on how to translate.
  3. After you finished, wait for project owner to sync the translations.
  4. If you're translating markdown files in src/locales/en/*.mdx, create a Pull-request instead.
  5. Ask for help in the Issues.

Development

# locales/en.yaml
client.common.hello: >-
  Hello {{name}}
server.common.hello: >-
  Hello %s
client.plural_one: >-
  item
client.plural_other: >-
  items
# php
t('server.common.hello', ['Values' => ['Name']]);
t('client.plural', ['Count' => 1]);  #-> item
t('client.plural', ['Count' => 2]);  #-> items
// js
t('client.common.hello', { name: 'Name' })
t('client.plural', { count: 1 }) //-> item
t('client.plural', { count: 2 }) //-> items

client.* keys are used in client side (JS), client.* and server.* keys are used in server side (PHP). Why:

  1. Client and server has different interpolation.
  2. Client can save 200K file size.