language files are located in the blended cities / locale directory.
each of them have a .lang extension and includes the translations for text, buttons and tips of the interface in a particular language.
they use the 2 letters language code defined by the W3C language subtab registry :
complete list : http://www.iana.org/assignments/language-subtag-registry
so the spanish language file should be es.lang, the german one should be de.lang etc..
Blended Cities gui is first written in english. the en.lang file is loaded by default (but you can change it). when the script is improved, it's the first to contain the new texts. if another default language is used, the en.lang file will be used to replace the missing translations, if any.
so if you want to maintain a translation you don't need to update the file everytime a new button is appended, as the script evolves. your file will continue to work.
the .lang file
a good start is to copy and rename the en.lang file with your language code. then either you run the script again (esc / confirm / alt-P) or select any language in the language drop-down menu (it will scan again the directory)
your file should appear :
in the image above I created an es.lang file (by copying the en.lang file then by renaming it).
open your lang file in a simple text editor ( windows users, here is an efficient and gnu/gpl one : notePad ++ )
you can see two sections enclosed in xml-like tags :
the <header> section is about you and your file. its format is common to the other third party files. (documentation to come).
the <gui> section contains all the translations :
- translations are grouped by tabs/subtabs, from 'Main' to 'Plugins',
- they are ordered as displayed in the gui, from top-left to bottom-right,
- OR they are grouped in the common part, when used in several locations of the interface.
for each line there's a variable name and a string value :
help is the text to be displayed, the string value. doc_text is the variable name. the only thing to edit is the string value. so for a french file, I would change it to :
you can use simple or double quotes around the string. if the sting contains single quotes, then use double quotes and vice versa :
example_text="('from mesh' source)"
example_text='("from mesh" source)'
example_text="don't touch that button"
- the variable names with a _text suffix are for buttons and text,
- the variable names with a _tt suffix are for tips. tips are the yellow information boxes that appears on buttons when 'tips' is activated in the main tab.
have a try :
run the script and choose the language code that corresponds to your .lang file,
in the lang file (es.lang in my case) replace the first string value, just under the <gui> line :
by something else, like :
select your language again in the interface (it will reload your file). you should obtain :
drop down menus can also be translated :
groundSource_list='Source %t|None %x2|Image %x0|Material %x1|Last groundMap %x3'
when editing this kind of line watch out for the %t, | %x2, %x3 characters, Blender needs them to build the menu. the numbers are not always ordered.
also watch out for spaces or text lenght, the buttons won't resize to the string lenght.
when you are done save it as an UTF8 text file. this way 'funny characters' will be displayed correctly in Blender, when the International Fonts' mode is enabled :
then you can contact me it you want I link to your site to download the translation or in order I host your file.