Currently i'm doing a project in C# where i've to support multiple languages. What i decided to do is this:
Create language xml files and put them in a folder ("langs").

Language file structure:

<Lang name="en" />

<!-- All forms -->

<form id="mainform">
    <item id="mnuFile" text="File" />
    <item id="mnuFileNew" text="New" />
    <item id="mnuFileEdit" text="Edit" />
</form>

<form id="options">
<!-- etc. -->
</form>

And on each form load, i'll go and read the user selected language file from the "langs" folder, and i will parse it to apply the changes to the form.

Note: I want to make it easy to creating new language files.
And i don't want to use the built-in VS stuffs.

So i would like to know if this is a good way of supporting multiple languages for an app or is there any other way of supporting multiple languages.
Usually which is the best way used by the software industry?
I just want to know your thoughts regarding this and i hope that i was enough clear with what i want to ask.

Thanks a lot for any help.:)

Recommended Answers

All 5 Replies

>I want to make it easy to creating new language files. And i don't want to use the built-in VS stuffs.

Disjoint presentation from programming. Resource bundles (Resource files) are easier and faster to use than xml. In my experience, it is easier to have all of your localized resources in one place.

I'm no expert, but your way seems good for me. Making resource files is easy, but they become dlls after building and user can't add more languages because it's hard coded in the app. That's why I don't like resource way proposed by microsoft. Adding simple text(xml) like language filed to a dir is a good solution if you ask me!

Using resources can be easily updated if you use an "languages" dll and have your app check for update versions from a webserver. but the XML approach isn't a bad one, just its important for speed that you don't access the file every time you need the information. Disk access is slow and so is parsing XML. if the form has a lot of text on it there could be a delay of opening a new form which can be annoying.

If you create an object in your application with all static members that match your language text, at application start you can check the language of the OS or Language setting and load all the information to the Language object then when new forms open you can use the Language object to get the necessary text.

But to each their own. I don't think there is a "best way" but there are many good ways. if you wanted to be far fetched you could use one of those google translation apis and have your application make web queries and just translate the English version on the fly using the web and instantly support any translation that api does. I wouldn't recommend it, but it could work. :)

thanks but can anyone tell us the exact aproch to built that kind of application with some described source code associated with the form or any control?

If you're using either RESX or XML to localize your application, I suggest for the string translation part the online software localization tool https://poeditor.com/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.