is I18N possible in mods (gamestrings)
Hi,
recently someone was asking for NS2+ do be translated. I found that idea intriguing so I had a shot at it since it is hosted on github.
However my preliminary tests showed that there is a big issue:
Although the gamestrings folder is properly loaded and the strings defined in the language files are properly resolved when using
A workaround would be to take, and copy the current translation files while appending one's own custom strings. But each time NS2 updates one would have to check for changes in the translations and merge those into the mod-shipped files which is not feasible.
So the questions are:
1. Did I take a wrong turn? Is there a different approach one should take to introduce translatable strings in a mod?
2. If not (and this should be answered by devs) will we see gamestrings properly merging (expected behaviour would be appending+overriding) instead of clearing in the future?
Thanks and regards
recently someone was asking for NS2+ do be translated. I found that idea intriguing so I had a shot at it since it is hosted on github.
However my preliminary tests showed that there is a big issue:
Although the gamestrings folder is properly loaded and the strings defined in the language files are properly resolved when using
Locale.ResolveString("MY_CUSTOM_TEXT")all previously defined string translations (from n2/gamestrings) had been cleared. Resulting in a rather ugly main menu showing only the keys instead of the translation values.
A workaround would be to take, and copy the current translation files while appending one's own custom strings. But each time NS2 updates one would have to check for changes in the translations and merge those into the mod-shipped files which is not feasible.
So the questions are:
1. Did I take a wrong turn? Is there a different approach one should take to introduce translatable strings in a mod?
2. If not (and this should be answered by devs) will we see gamestrings properly merging (expected behaviour would be appending+overriding) instead of clearing in the future?
Thanks and regards
Comments
You have to add gamestrings to the file to include the extra translations. Or you'll end up with all your default NS2 gamestrings set to their call name as you have seen.
Gamestrings cannot be hooked as they are text files, your only solution is to append them with the new data.
I used something like this in classic, loading my own files with just the changes/additions and cached it all to a table.
I think it is a pity that it does not seem to be on the agenda for extending the modding tools.
So I personally will probably go with overloading the Locale.ResolveString function like xDragon said.
It sounds like a reasonable approach since this feels as close to the core API as it would get.
I was getting the impression that it was possible since the "sample mod" tutorial was shipping gamestrings as well.
(http://forums.unknownworlds.com/discussion/comment/2239071/#Comment_2239071)