mirror of
https://github.com/maputnik/editor.git
synced 2026-05-05 07:40:02 +00:00
## Launch Checklist <!-- Thanks for the PR! Feel free to add or remove items from the checklist. --> - [x] Briefly describe the changes in this PR. - [x] Link to related issues. - [x] Include before/after visuals or gifs if this PR includes visual changes. - [ ] Write tests for all new functionality. - [x] Add an entry to `CHANGELOG.md` under the `## main` section. ## Changes - This pull request makes use of the FileSystemFileHandle API to modify a local file. No need to download it - just click save. - I don't know how to cover this functionality by tests so I need directions in case test coverage is required. - The pull request adds [@types/wicg-file-system-access](https://www.npmjs.com/package/@types/wicg-file-system-access) as a new dev dependency which I am not really pleased about but can't think of a way around it. ## Known Limitations - The used File API is only available in when accessed from https or on localhost. - There is no visual indicator that the file has been saved. Previously the browser showed it as a new download. ## Issue - https://github.com/maplibre/maputnik/issues/964 ## Screenshots ### Menu <img src="https://github.com/user-attachments/assets/dfcfc5c2-0019-4857-ba26-224b5598fc11" /> ### Open modal <img src="https://github.com/user-attachments/assets/4e1293e8-16b6-4b86-925b-3bebb49d8ca6" height="200px" /> ### Save modal <img src="https://github.com/user-attachments/assets/4f10e2c0-2dd3-4726-a613-30e0406619b0" height="200px" /> --------- Co-authored-by: Harel M <harel.mazor@gmail.com>
61 lines
2.2 KiB
Markdown
61 lines
2.2 KiB
Markdown
## Internationalization
|
|
|
|
The process of internationalization is pretty straight forward for Maputnik.
|
|
|
|
## Add a new language
|
|
|
|
#### 1. Edit configuration
|
|
|
|
In order to add a new translation you'll need to add it to the configuration files. Please put it in alphabetical order.
|
|
|
|
- Open [/i18next-parser.config.ts](/i18next-parser.config.ts) and add the ISO Code of your language to the `locales` array.
|
|
- Now, open [/src/i18n.ts](/src/i18n.ts) and add the ISO Code and localized name to the supported languages.
|
|
|
|
#### 2. Add the localized strings
|
|
|
|
Refresh the localization to generate a new directory under `/src/locales/` for your new language.
|
|
|
|
```bash
|
|
npm install
|
|
npm run i18n:refresh
|
|
```
|
|
|
|
Replace every `__STRING_NOT_TRANSLATED__` value in the newly generated `translation.json` file with the according translation.
|
|
Make sure all the keys are translated.
|
|
|
|
#### 3. Test your new locale
|
|
|
|
Finally, test your language locally by starting a local instance of Maputnik.
|
|
|
|
```bash
|
|
npm run start
|
|
```
|
|
|
|
Consider adding your name as a helping person for the translation of new features.
|
|
|
|
## Add localization for a new feature
|
|
|
|
If you happen to add a feature which needs some text to be translated, update the translation files.
|
|
After running, check your working copy for files and add/correct as needed.
|
|
|
|
```bash
|
|
npm run i18n:refresh
|
|
```
|
|
|
|
The following users can help you with the relevant languages:
|
|
|
|
| ISO Code | Language | User |
|
|
|----------|--------------------|--------------------------------------------|
|
|
| de | German | [@josxha](https://github.com/josxha) |
|
|
| en | English | [@HarelM](https://github.com/HarelM) |
|
|
| fr | French | [@lhapaipai](https://github.com/lhapaipai) |
|
|
| hr | Hebrew | [@HarelM](https://github.com/HarelM) |
|
|
| ja | Japanese | [@keichan34](https://github.com/keichan34) |
|
|
| zh | Simplified Chinese | [@jieme](https://github.com/jieme) |
|
|
|
|
You can test the UI in different languages using the dropdown in the top menu
|
|
Note that Maputnik automatically localize based on browser language settings and stores this language in local storage.
|
|
You can use incognito mode to check a first time usage.
|
|
|
|
|