Our localization works in the following manner:
_L("Loader")_L() macro detects user's language and if it's non-english, it looks up the translation for the english phrase and displays that, instead.This is plain wrong because languages don't work this way. The fact that single english phrase/word suits multiple places doesn't mean the same will be true for any other language. The phrase "Loader" above was not chosen randomly - when I first started 0.38, it used my native language (czech) and the loader UI window was titled "Naklada膷" (= "Cargo loader"). I immediately knew where's the problem.
Our options:
I favor the former option (MAINMENU_BUTTON_OPTIONS).
Opinions?
Re-making of the GUI has begun: https://github.com/RigsOfRods/rigs-of-rods/pull/1333 - so it's time to start re-making the localization, too.
UPDATE Dec 2018: This is outdated, I suggest to use https://www.gnu.org/software/gettext/manual/html_node/Contexts.html instead
We need a syntax for the message ID strings. Here's my draft:
// Syntax: AREA]/WINDOW[/CONTAINER]/[TextPreview]
// Areas:
// m = main menu
// s = simulation
// x = (multiple areas)
// r = rig editor (near future)
// t = terrain editor (future)
// Examples:
m/menu/SinglePlayer // Main menu
m/menu/MultiPlayer
m/menu/Settings
m/menu/About
m/menu/ExitGame
m/about/AboutRigsOfRods // Main menu - about dialog
m/about/OK
x/mpusers/Name // The multiplayer userlist (both menu and sim)
x/mpusers/Ping
s/top/Simulation // Simulation top menubar
s/top/Vehicles
s/top/Tools
s/top/sim/GetNewVehicle // ... and it's menus: Simulation
s/top/sim/ReloadCurrVehicle
s/top/sim/RemoveCurrVehicle
s/top/veh/UserName // ... vehicles menu
s/top/tools/FrictionSettings // ... tools menu
s/top/tools/ShowNodeNumbers
I would gladly translate it to Serbian when I suppose .po files are avalible
IIRC RoR makes use of gettext for localization. I think gettext takes into account the location of the source string in the source code (source file + line) to prevent what you described. See here for an example: https://en.wikipedia.org/wiki/Gettext
I think on Transifex the location of the source string is mentioned when doing translations. It's possible that the translation in your example is based on a misunderstanding.
@Hiradur Thanks for the input, but I didn't find any evidence of it on the wikipage. Further, such arrangement would be a very bad idea because both file name and line number of the source may change (the line number is quite certain to change IMO).
It's likely that I'm not using gettext the way it was intended, but I don't care. TBH I think gettext is a living fossil and the surrounding toolchain can only appeal to die-hard UNIX commandline programmers.
Maybe the README.md located at https://github.com/RigsOfRods/rigs-of-rods/tree/master/tools/linux/l10n can help you understand it a bit better. I can't say I fully know how it works but to keep up with changing line numbers you have to extract a new template shortly before the next release and merge it with existing translations. Usually the merging process can transfer all existing translations to their new correct location.
Your solution has the disadvantage that it would be a homebrewed solution unique to RoR which means it would lack support from translation platforms like Transifex and knowledge from contributors.
@Hiradur Ugh... WHAT?!! 馃あ 馃槨 How are people still willing to put up with this?
Thanks for bringing this into my attention. Seriously I'm disgusted right now. I imagine l10n as simply matter of loading a string table from an INI file and then looking up texts there via some sensible hash table. I completely fail to understand why are all internet resources directly or indirectly pushing me to use the gettext suite which is famously unportable beyond unix, forcing you to hack around and use other libs, and it's all pointlessly complicated.
Umm... I need to do more research on the state of affairs with l10n these days. Nothing makes sense to me.
Well, it looks complicated but on the other hand it works and can be automated so that you can forget about it after you set up some scripts and run them from time to time.
I've added support for looking up strings with contexts to MofileReader: http://anotherfoxguy.com/MofileReader/classmo_file_reader.html#a9459d21908db8ba4e40693b4332777ce
@AnotherFoxGuy Awesome
@only-a-ptr Can we close this?
Closing as localization is now done absolutely right.