Translation File Builder and UTF-8


To avoid weird chars (which are quite common in some languages) in the translation files, maybe this part of createFinishedTranslationFile() :

        for (int i = 0; i < preStrings.size(); ++i)
            lines.add ("\"" + escapeString (preStrings[i])
                       + "\" = \""
                       + escapeString (postStrings[i]) + "\"");

should be changed to something such as :

        for (int i = 0; i < preStrings.size(); ++i)
            lines.add (CodeHelpers::stringLiteral (preStrings[i])
                       + " = "
                       + CodeHelpers::stringLiteral (postStrings[i]));

what do you think?


Well, CodeHelpers::stringLiteral is the wrong function to use because it inserts C++ code like "CharPointer_UTF8", but using CodeHelpers::addEscapeChars might do the trick?


..ah,  but no - the LocalisedString class won't actually parse any extended escape characters, so that won't actually work.


ah, yes, I did not think about that!

but I should be worried about chars like ñ é ê õ, etc... in my translation files right?

if so, do you think about something I could do for everything to be ok? Would that mean some changes to LocalisedString ?


Well, as long as the file is UTF8 and your text editor is doing its job properly, then everything should work just fine. And TBH when you're editing these files you probably do want to actually see the extended characters rather than some escaped sequences. It's not like working on a source-file where you need to ensure the compiler gets it right.


I am having a problem with the Norwegian language on Windows. I have not tried it on Mac, yet.

I am using Translation File build to convert the work “Meter” which translates to Måler.

The results are placed in a NotePad .txt file.

When displayed in program the second character is a square box.
I have tried various fonts, but nothing seems to work.

I have French and Chinese working but can’t solve the font problem.

The top of the text file is:
language: Norwegian
countries: NO

BTW, don’t we just love the word “should”.

Please help.