1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-04 09:42:40 +02:00
vcmi/docs/translators/Translations.md

218 lines
9.5 KiB
Markdown
Raw Permalink Normal View History

2024-07-16 20:29:20 +02:00
# Translations
2023-09-23 15:38:17 +02:00
## List of currently supported languages
This is list of all languages that are currently supported by VCMI. If your languages is missing from the list and you wish to translate VCMI - please contact our team and we'll add support for your language in next release.
- Czech
- Chinese (Simplified)
- English
- Finnish
- French
- German
- Hungarian
- Italian
- Korean
- Polish
- Portuguese (Brazilian)
- Russian
- Spanish
- Swedish
- Turkish
- Ukrainian
- Vietnamese
2024-05-06 00:46:21 +02:00
## Progress of the translations
2024-05-06 00:46:21 +02:00
You can see the current progress of the different translations here:
[Translation progress](https://github.com/vcmi/vcmi-translation-status)
The page will be automatically updated once a week.
2023-09-23 15:38:17 +02:00
## Translating Heroes III data
VCMI allows translating game data into languages other than English. In order to translate Heroes III in your language easiest approach is to:
- Copy existing translation, such as English translation from here: <https://github.com/vcmi-mods/h3-for-vcmi-englisation> (delete sound and video folders)
- Copy text-free images from here: <https://github.com/vcmi-mods/empty-translation>
2023-09-23 15:38:17 +02:00
- Rename mod to indicate your language, preferred form is "(language)-translation"
- Update mod.json to match your mod
2024-09-08 10:02:27 +02:00
- Translate all texts strings from `game.json`, `campaigns.json` and `maps.json`
2024-01-06 00:02:14 +02:00
- Replace images in data and sprites with translated ones (or delete it if you don't want to translate them)
- If unicode characters needed for language: Create a submod with a free font like here: <https://github.com/vcmi-mods/vietnamese-translation/tree/vcmi-1.4/vietnamese-translation/mods/VietnameseTrueTypeFonts>
2023-09-23 15:38:17 +02:00
2024-09-08 10:02:27 +02:00
If you can't produce some content on your own (like the images or the sounds):
2024-09-08 10:02:27 +02:00
- Create a `README.md` file at the root of the mod
- Write into the file the translations and the **detailled** location
2024-09-08 10:02:27 +02:00
This way, a contributor that is not a native speaker can do it for you in the future.
2023-09-23 15:38:17 +02:00
If you have already existing Heroes III translation you can:
- Install VCMI and select your localized Heroes III data files for VCMI data files
2024-04-08 13:05:49 +02:00
- Launch VCMI and start any map to get in game
- Press Tab to activate chat and enter '/translate'
2023-09-23 15:38:17 +02:00
2024-04-08 13:05:49 +02:00
This will export all strings from game into `Documents/My Games/VCMI/extracted/translation/` directory which you can then use to update json files in your translation.
To export maps and campaigns, use '/translate maps' command instead.
2023-09-23 15:38:17 +02:00
2024-10-16 22:37:18 +02:00
### Video subtitles
2024-10-16 22:37:18 +02:00
It's possible to add video subtitles. Create a JSON file in `video` folder of translation mod with the name of the video (e.g. `H3Intro.json`):
```json5
2024-10-16 22:37:18 +02:00
[
{
"timeStart" : 5.640, // start time, seconds
"timeEnd" : 8.120, // end time, seconds
"text" : " ... " // text to show during this period
},
...
]
```
2023-09-23 15:38:17 +02:00
## Translating VCMI data
VCMI contains several new strings, to cover functionality not existing in Heroes III. It can be roughly split into following parts:
- In-game texts, most noticeably - in-game settings menu.
- Game Launcher
- Map Editor
2024-01-06 00:02:14 +02:00
- Linux specific
- Android Launcher
2023-09-23 15:38:17 +02:00
Before you start, make sure that you have copy of VCMI source code. If you are not familiar with git, you can use Github Desktop to clone VCMI repository.
### Translation of in-game data
2023-08-12 23:26:58 +02:00
2023-09-23 15:38:17 +02:00
In order to translate in-game data you need:
2023-09-23 15:38:17 +02:00
- Add section with your language to `<VCMI>/Mods/VCMI/mod.json`, similar to other languages
- Copy English translation file in `<VCMI>/Mods/VCMI/config/vcmi/english.json` and rename it to name of your language. Note that while you can copy any language other than English, other files might not be up to date and may have missing strings.
- Translate copied file to your language.
2023-08-12 23:26:58 +02:00
2023-09-23 15:38:17 +02:00
After this, you can set language in Launcher to your language and start game. All translated strings should show up in your language.
2023-08-12 23:26:58 +02:00
2023-09-23 15:38:17 +02:00
### Translation of Launcher and Editor
2023-09-01 11:11:35 +02:00
2023-09-23 15:38:17 +02:00
VCMI Launcher and Map Editor use translation system provided by Qt framework so it requires slightly different approach than in-game translations:
2023-08-12 23:26:58 +02:00
- Install Qt Linguist. You can find find standalone version here: <https://download.qt.io/linguist_releases/>
2024-09-08 10:02:27 +02:00
- Open `<VCMI Sources>/launcher/translation/` directory, copy `english.ts` file and rename it to your language
- Open `<VCMI Sources>/launcher/CMakeLists.txt` file with a text editor. In there you need to find list of existing translation files and add new file to the list.
2023-09-23 15:38:17 +02:00
- Launch Qt Linguist, select Open and navigate to your copied file
- Select any untranslated string, enter translation in field below, and click "Done and Next" (Ctrl+Return) to navigate to next untranslated string
- Once translation has been finished, save resulting file.
Translation of Map Editor is identical, except for location of translation files. Open `<VCMI Sources>/editor/translation/` instead to translate Map Editor
TODO: how to test translation locally
2024-01-06 00:02:14 +02:00
### Translation of Linux specific files
2024-01-06 00:02:14 +02:00
#### Translation of AppStream metainfo
The [AppStream](https://freedesktop.org/software/appstream/docs/chap-Metadata.html) [metainfo file](https://github.com/vcmi/vcmi/blob/develop/launcher/eu.vcmi.VCMI.metainfo.xml) is used for Linux software centers.
It can be translated using a text editor or using [jdAppStreamEdit](https://flathub.org/apps/page.codeberg.JakobDev.jdAppStreamEdit):
- Install jdAppStreamEdit
- Open `<VCMI>/launcher/eu.vcmi.VCMI.metainfo.xml`
- Translate and save the file
2024-01-06 00:02:14 +02:00
##### Desktop file
2024-01-06 00:02:14 +02:00
- Edit `<VCMI>/launcher/vcmilauncher.desktop` and `<VCMI>/launcher/vcmieditor.desktop`
- Add `GenericName[xyz]` and `Comment[xyz]` with your language code and translation
##### Translation of Android Launcher
2024-01-06 00:02:14 +02:00
- Copy `<VCMI>/android/vcmi-app/src/main/res/values/strings.xml` to `<VCMI>/android/vcmi-app/src/main/res/values-xyz/strings.xml` (`xyz` is your language code)
- Translate this file
See also here: <https://developer.android.com/guide/topics/resources/localization>
2023-09-23 15:38:17 +02:00
### Submitting changes
Once you have finished with translation you need to submit these changes to vcmi team using git or Github Desktop
2023-09-23 15:38:17 +02:00
- Commit all your changed files
- Push changes to your forked repository
- Create pull request in VCMI repository with your changes
If everything is OK, your changes will be accepted and will be part of next release.
## Translating mods
### Exporting translation
2024-04-08 13:05:49 +02:00
If you want to start new translation for a mod or to update existing one you may need to export it first. To do that:
- Enable mod(s) that you want to export and set game language in Launcher to one that you want to target
- Launch VCMI and start any map to get in game
- Press Tab to activate chat and enter '/translate'
After that, start Launcher, switch to Help tab and open "log files directory". You can find exported json's in 'extracted/translation' directory.
If your mod also contains maps or campaigns that you want to translate, then use '/translate maps' command instead.
2023-09-23 15:38:17 +02:00
If you want to update existing translation, you can use '/translate missing' command that will export only strings that were not translated
2023-09-23 15:38:17 +02:00
### Translating mod information
2024-09-08 10:02:27 +02:00
In order to display information in Launcher in language selected by user add following block into your `mod.json`:
```json5
2023-08-12 23:26:58 +02:00
"<language>" : {
"name" : "<translated name>",
"description" : "<translated description>",
"author" : "<translated author>",
2023-09-23 15:38:17 +02:00
"translations" : [
"config/<modName>/<language>.json"
]
2023-08-12 23:26:58 +02:00
},
```
2024-09-08 10:02:27 +02:00
However, normally you don't need to use block for English. Instead, English text should remain in root section of your `mod.json` file, to be used when game can not find translated version.
2023-08-12 23:26:58 +02:00
### Translating in-game strings
2024-04-08 13:05:49 +02:00
After you have exported translation and added mod information for your language, copy exported file to `<mod directory>/Content/config/<mod name>/<language>.json`.
Use any text editor (Notepad++ is recommended for Windows) and translate all strings from this file to your language
## Developers documentation
2023-08-12 23:26:58 +02:00
### Adding new languages
2023-08-12 23:26:58 +02:00
In order to add new language it needs to be added in multiple locations in source code:
2024-09-08 10:02:27 +02:00
- Generate new .ts files for launcher and map editor, either by running `lupdate` with name of new .ts or by copying `english.ts` and editing language tag in the header.
- Add new language into `lib/Languages.h` entry. This will trigger static_assert's in places that needs an update in code
2023-09-23 15:38:17 +02:00
- Add new language into json schemas validation list - settings schema and mod schema
- Add new language into mod json format - in order to allow translation into new language
2023-08-12 23:26:58 +02:00
Also, make full search for a name of an existing language to ensure that there are not other places not referenced here
2023-09-23 15:38:17 +02:00
2023-08-12 23:26:58 +02:00
### Updating translation of Launcher and Map Editor to include new strings
2023-09-23 15:38:17 +02:00
2024-09-08 10:02:27 +02:00
At the moment, build system will generate binary translation files (`.qs`) that can be opened by Qt.
2023-08-12 23:26:58 +02:00
However, any new or changed lines will not be added into existing .ts files.
2024-09-08 10:02:27 +02:00
In order to update `.ts` files manually, open command line shell in `mapeditor` or `launcher` source directories and execute command
```sh
2023-08-12 23:26:58 +02:00
lupdate -no-obsolete * -ts translation/*.ts
```
2023-09-23 15:38:17 +02:00
2024-09-08 10:02:27 +02:00
This will remove any no longer existing lines from translation and add any new lines for all translations. If you want to keep old lines, remove `-no-obsolete` key from the command.
2023-08-12 23:26:58 +02:00
There *may* be a way to do the same via QtCreator UI or via CMake, if you find one feel free to update this information.
2023-09-23 15:38:17 +02:00
2023-08-12 23:26:58 +02:00
### Updating translation of Launcher and Map Editor using new .ts file from translators
2023-09-23 15:38:17 +02:00
2023-08-12 23:26:58 +02:00
Generally, this should be as simple as overwriting old files. Things that may be necessary if translation update is not visible in executable:
2023-08-12 23:26:58 +02:00
- Rebuild subproject (map editor/launcher).
- Regenerate translations via `lupdate -no-obsolete * -ts translation/*.ts`