Tldraw/guides/translation.md

48 wiersze
1.4 KiB
Markdown
Czysty Zwykły widok Historia

2022-06-25 19:03:37 +00:00
# Translation
Thanks for your interest in translating tldraw! This file has instructions for updating a translation or creating a new translation.
## Update an Existing Translation
Want to update or correct an existing translations?
Create a new branch on Github.
Open the language file in `packages/tldraw/src/translations`
Make whichever changes you like.
Submit your branch as a PR on Github.
## Add a New Translation
Want to add a new language to our translations?
Create a new branch on Github.
In the `packages/tldraw/src/translations` folder, duplicate the `main.json` file.
2022-06-25 19:03:37 +00:00
2022-06-25 19:37:00 +00:00
Rename the new file to the [language code](https://gist.github.com/wpsmith/7604842) for that language. For example, if you were making an Esperanto translation, name the new file `eo.json`.
In the `packages/tldraw/src/translations/translations.ts` file, import your file and create a new entry in to the `TRANSLATIONS` array like this:
2022-06-25 19:03:37 +00:00
```ts
import en from './en.json'
2022-06-26 07:33:08 +00:00
import ar from './ar.json'
import eo from './eo.json' // <-- import here
2022-06-25 19:03:37 +00:00
2022-06-26 07:33:08 +00:00
export const TRANSLATIONS: TDTranslations = [
// Default language:
2022-06-25 19:03:37 +00:00
{ code: 'en', label: 'English', messages: en },
2022-06-26 07:33:08 +00:00
// Translations:
2022-06-25 19:37:00 +00:00
{ code: 'ar', label: 'عربي', messages: ar },
2022-06-26 07:33:08 +00:00
{ code: 'eo', label: 'Esperanto', messages: eo }, // <-- add an entry here
]
2022-06-25 19:03:37 +00:00
```
2022-06-26 07:36:59 +00:00
Translate the messages in the new file from English to your language.
2022-06-25 19:37:00 +00:00
That's it!
2022-06-25 19:03:37 +00:00
Submit your branch as a PR on Github.