TheSwamp

Code Red => .NET => Topic started by: huiz on June 24, 2013, 04:32:56 PM

Title: Conceptual thinking: support different translations
Post by: huiz on June 24, 2013, 04:32:56 PM
There are a few possibilities to support translations in the software. Also in Visual Studio there are options to use different languages but I'm not sure if that is the best or most flexible system.

I thought of a way to support other languages in my software. How should I do that without the need to rewrite everything or to build different versions. Because I have experience with systems like WordPress, I thought of using the language system of WordPress. That is using functions to echo the tekst onto the screen ( i.e. "_e('Hello World!')" ), but if it finds a translation then it will print that line in another language.

So, I can use a function that does the same thing with strings, and use this also when a Form initializes, checking each text value of the existing controls and change that in the wanted language. In that way I can support different languages with just a text file or XML. People can create their own translations too.

But is it effective to loop through a lot of strings every time? Are there better ways? Do I miss some pros and cons?

Pro:
- translation files outside the software
- people can add/edit
- easy to translate texts on controls
- if no translation available it still shows readable text in original language
- no need to compile a lot of different versions

Con:
- not easy to control the text length (on controls)
- not all software is useful in other countries, so supporting a translation system might be overkill
- searching very long strings in a huge XML might not be efficient
- how to use different local date formats and seperators in numbers

Well, to be short, how do YOU do this? :-)
Title: Re: Conceptual thinking: support different translations
Post by: WILL HATCH on June 24, 2013, 08:50:14 PM
I saw this on Through The Interface once, it used resources to hold strings. I'll try to find the post for you.
I haven't crossed this road personally http://through-the-interface.typepad.com/through_the_interface/2009/06/registering-autocad-commands-with-localized-names-using-net.html  (http://through-the-interface.typepad.com/through_the_interface/2009/06/registering-autocad-commands-with-localized-names-using-net.html).
Title: Re: Conceptual thinking: support different translations
Post by: huiz on June 25, 2013, 02:22:53 AM
Thanks Will, I found that too. But it is not quite the easy solution I had in mind :-)