diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 2a8847cc..c352829e 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -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) diff --git a/docs/changelog.md b/docs/changelog.md index 13e82edc..9c2fac2b 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -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) diff --git a/docs/i18n.md b/docs/i18n.md new file mode 100644 index 00000000..bc72eee1 --- /dev/null +++ b/docs/i18n.md @@ -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. diff --git a/docs/lang.md b/docs/lang.md new file mode 100644 index 00000000..3f04d5ad --- /dev/null +++ b/docs/lang.md @@ -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.