Skip to content

Commit

Permalink
Export 1.4.4+ localization files feature
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidPack committed Jan 5, 2023
1 parent 5515933 commit aafbbe3
Show file tree
Hide file tree
Showing 17 changed files with 3,235 additions and 32 deletions.
22 changes: 11 additions & 11 deletions ExampleMod/Localization/en-US.hjson
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# You may find this .hjson file approach to translations easier for your mod.
# All localization happens in hjson files. These files contains the display names of content and other text values that will differ between languages.
# .hjson files contain translations for the language specified in the filename. (Make sure this file is UTF-8 encoded only.)
# The possible languages are: English ("en-US"), German ("de-DE"), Italian ("it-IT"), French ("fr-FR"), Spanish ("es-ES"), Russian ("ru-RU"), Chinese ("zh-Hans"), Portuguese ("pt-BR"), and Polish ("pl-PL")
# Localization files will be automatically updated with new content. After building and reloading the mod, new entries will appear in hjson files and can then be filled in.
# Here in ExampleMod we have organized these files in a folder called Localization. A single file per language makes it extremely easy to to integrate and maintain translations.
# Each translation entry in .hjson files contains a key and a value. The key is determined following the rules of JSON [https://www.w3schools.com/js/js_json_syntax.asp]
# The Key automatically inherits "Mods.ModNameHere.", which is useful to know if you want to use substitutions (as seen in the Paper Airplane example) or use Language.GetTextValue or Network text.
# The following are the currently autogenerated keys: ItemName, ItemTooltip, BuffName, BuffDescription, ProjectileName, NPCName, MapObject, and Prefix
# Comments and non-autogenerated keys will be preserved and automatically mirrored to the non-English hjson files
# For more info on localization, see https://github.com/tModLoader/tModLoader/wiki/Localization

Mods: {
ExampleMod: {
Expand Down Expand Up @@ -53,6 +53,13 @@ Mods: {
ExamplePylonTileAdvanced: "{$Mods.ExampleMod.ItemName.ExamplePylonItemAdvanced}"
}

ItemName: {
ExamplePetItem: "{$Mods.ExampleMod.Common.PaperAirplane}"
ExampleSpecificAmmoGun: '''Example Rifle'''
ExamplePylonItem: "Example Pylon"
ExamplePylonItemAdvanced: "Unstable Pylon"
}

ItemTooltip: {
# These 2 examples show using substitutions. Here we use a vanilla Key and a key from this Mod to generate the text: "Nearby players get a bonus against: Octopus".
# Note that the translation files for other languages don't need to define ItemTooltip.OctopusBanner, they would only need to define NPCName.Octopus, as seen in zh-Hans.hjson file.
Expand Down Expand Up @@ -89,13 +96,6 @@ Mods: {
ExampleMultiUseItem: Can be used 4 times
}

ItemName: {
ExamplePetItem: "{$Mods.ExampleMod.Common.PaperAirplane}"
ExampleSpecificAmmoGun: '''Example Rifle'''
ExamplePylonItem: "Example Pylon"
ExamplePylonItemAdvanced: "Unstable Pylon"
}

ProjectileName: {
ExamplePetProjectile: "{$Mods.ExampleMod.Common.PaperAirplane}"
}
Expand Down
Loading

0 comments on commit aafbbe3

Please sign in to comment.