Update documentation on i18n system.

This commit is contained in:
Lucas Nicodemus 2022-10-20 02:10:31 -07:00
parent fda1de52a9
commit a10bff1018
No known key found for this signature in database
4 changed files with 23 additions and 0 deletions

View file

@ -6,9 +6,13 @@
* [Tile providers](/tile-providers.md)
* [Message-of-the-day](/motd.md)
* [Server-side characters](/ssc.md)
* [Languages](/lang.md)
* Field definitions
* [Permissions](/permission-descriptions.md)
* [REST fields](/rest-fields.md)
* [config.json fields](/config-file-descriptions.md)
* [sscconfig.json fields](/ssc-config.md)
* Developer documentation
* [i18n in the tshock project](/i18n.md)

View file

@ -61,6 +61,7 @@ Use past tense when adding new entries; sign your name off when you add or chang
* Fixed an exploit with grass mowing not removing hanging vines. (@punchready)
* Added `-additionalplugins` command line argument to load additional plugins. (@pontaoski)
* Added localization support for console spam reduction. (@KawaiiYuyu)
* Added an internationalization system. The base for the i18n system was built by Janet Blackquill ([@pontaoski](https://github.com/pontaoski)). A small donation in her honor was made to the [KDE project](https://kde.org/) as a thankyou for this work. This also includes the `TSHOCK_LANGUAGE` environment variable. Setting `TSHOCK_LANGUAGE=tok` will enable a small number of [Toki Pona](https://tokipona.org/) translations as a proof-of-concept. (@pontaoski)
## TShock 4.5.18
* Fixed `TSPlayer.GiveItem` not working if the player is in lava. (@PotatoCider)

11
docs/i18n.md Normal file
View file

@ -0,0 +1,11 @@
TShock supports the concept of multiple languages using `GetText.NET`.
CI is automatically designed to build and push updated `.po` files (the source for lang files) based on usage in TShock.
To use a localized string instead of a standard string, use `I18n.C.GetString()`. For example, `I18n.C.GetString("Invalid command!")` instead of `"Invalid command!"`.
A test language file has been added that converts a limited number of phrases to [Toki Pona](https://tokipona.org/), the language of good. To use this, you can set an environment variable called `TSHOCK_LANGUAGE` set to `tok`. For example, `TSHOCK_LANGUAGE=tok dotnet run --project TShockLauncher`. Then, run the `die` command.
The automatic `.po` to `.mo` compilation only works if you have `msgfmt` installed (part of Git Bash, or part of `gettext` itself). If you don't have this, when you run in debug mode, it will fail to compile the `.mo` file in the `i18n` folder. If this happens, you may want to download the latest artifacts from GitHub, and pull out the `.mo` file(s) of choice and place them into the `i18n` folder.
The base for the i18n system was built by Janet Blackquill ([@pontaoski](https://github.com/pontaoski)). A small donation in her honor was made to the [KDE project](https://kde.org/) as a thankyou for this work.

7
docs/lang.md Normal file
View file

@ -0,0 +1,7 @@
TShock supports automatic language detection based on your system regional settings. If you want to override this, set the `TSHOCK_LANGUAGE` environment variable to a different language. Currently, only a limited number of [Toki Pona](https://tokipona.org/) translations are available, by setting `TSHOCK_LANGUAGE` to `tok`. Translation work is underway to translate TShock into different languages.
If you can't load other languages, make sure that you still have a folder called `i18n` and that your language folder of choice contains a `.mo` file. If it does, those translations should load successfully if you override the language settings using `TSHOCK_LANGUAGE` or if you set your regional settings to the right language.
This system is separate from Terraria's language system. You may still want to pass `-lang` on the command line to set the language for Terraria.
The base for the i18n system was built by Janet Blackquill ([@pontaoski](https://github.com/pontaoski)). A small donation in her honor was made to the [KDE project](https://kde.org/) as a thankyou for this work.