-
Notifications
You must be signed in to change notification settings - Fork 85
Adding a new language
If you are a translator, please see: Localisation
This guide is primarily aimed at TM:PE support team who will ensure the new language is properly defined, but translators are more than welcome to go through these steps themselves if they feel comfortable doing so.
When adding a new language, the file must be embedded within the published TM:PE files (not just copied to the build folder) and the Translation.cs
class must also be updated.
Common errors are:
- Invalid filename (should be
lang_*.txt
, where*
is language code - eg.es
orzh-tw
, etc.) - Actual line breaks within translation strings (use
\n
instead) - Missing space between key and value
- Translated keys (they should all be in English)
- Missing keys - copy them over from
lang.txt
, including the English values; they can be translated later
See: Localisation for full details.
The localisation file must be placed in TLM/TLM/Resources
folder, where all the existing lang_*.txt
files are.
Open Visual Studio and under the TLM
project, find and right-click the Resources
folder then choose Add existing item...
:
Locate the new file (you might need to set file types to All Files
in the file dialog) and add it.
Once added:
- Right-click the file in the sidebar (eg.
lang_es.txt
) - Choose
Properties...
- Make sure
Build Action
is set toEmbedded Resource
Open the TLM/TLM/UI/Translation.cs
file in Visual Studio and locate the Translation()
constructor.
You will see two lists being populated, both need updating to include the new language.
Note: For ease of maintenance, the lists are sorted by language code, so insert or append the new language as applicable.
Add the language code, for example if the filename is lang_es.txt
you'd add:
AVAILABLE_LANGUAGE_CODES.Add("es");
Then add the label that will appear in the drop-down language select list in General Settings, for example:
LANGUAGE_LABELS["es"] = "Español";
As you can see the label should be the translated name of the language.
- Save your changes, then build the project (
Ctrl
+Shift
+B
). For more info, see: - Launch C:SL and make sure the local version of the mod is enabled (unsubscribe any other versions)
- Start a new game, and then go in to TM:PE mod options and change the language.
- In particular, test:
- Text in the mod options - make sure no overlaps
- Tool tips on the Toolbar
- Text in the Traffic Lights editor window
- Help popups (with a TM:PE tool active, click the games'
?
advisor button)
If it all looks good, submit a PR (or commit to the existing PR) ready for code review.
Remember to update the Languages page in the wiki after the PR is merged.
Red links are broken; this wiki is a work in progress
Getting Started (click to open)
Troubleshooting / Bugs (click to open)
- Hints Panel
- Road & Rail:
- Junctions:
- Despawning:
- Info Views:
- Roads/Tracks:
- Nodes, Segments, Lanes
- Collector Roads
- Dedicated Turning Lanes
- Enter Blocked Junctions
- High Priority Roads
- Highway Junction Rules
- Lane Changes
- Pedestrian Crossings
- Priority Routes
- Road Conditions
- Roundabouts
- Roundabout Policies
- Stay in Lane
- Turn on Red
- U-Turns
- Unprotected Turns
- Vehicle Restriction Aggression
- Public Transport:
- Vehicles:
Todo: