Hi All
Moving on.
It is apparent that any programme to help in producing a multiligual PB programme has to have several parts.
The first is of course the language files. Separate files are the better solution I feel, as then only the files for the languages you wish to support need to be distributed and maintained. However there are of course two states for the language files. The first is the standard file which contains all the common words and phrases normally associated with a GUI. The second is an application specific language file which not only contains all the common words but also hold all application specific phrases for a particular application. Both need to be maintained separately. There is also the need to separate words which are the same but whose meaning changes dependant on context so categories are required. These files need to be standard to allow further expansion e.g. if in the future a Greek language file is produced then simply adding that file to the application should enable support for Greek the same of course with any language.
So first, the common words language file.
This is split into Categories. These are:-
Common. This holds all the common words\phrases.
Media Player. This holds words normally associated with media players.
Database. Words used in the context of a database.
Errors. Common error phrases applicable to all applications.
My Application. Empty in the standard file but used when adding phrases used in a specific application.
These are in the files now. Any suggestions for further categories are welcomed.
This does leave a file with hundreds of words, each of which needs to be accessed by a variable name. The problem when codeing is to select the correct variable not the correct language as the varable value will be changed dependant upon the language chosen.
To help with this I have programmed a little Variable Selector application. This allows you to programme in a normal fashion then when you reach a point where a literal string is required for say a button caption you select the category of the word and then the word click the select button and the variable name is copied to the clipboard you can then simply paste this into the programme. Of coursew this is a multilingual App in itself. (English and German only at this point).
I am considering how the multilingual function can be integrated into an application. This needs some consideration before commencing the codeing phase. The first and easiest way is to have the language selection at application start. You can store the users selection in a preferences file after the first run and show the language selection only if no previous selection has been made. This is achieved by this in three lines of code.
Code: Select all
;Includes and procedures to set language
IncludeFile "Locale.pbi"
Locale::AppLanguage = "en_GB" ;Set default language
Locale::Initialise()
Locale::SelectLanguage()
The second is to allow your users to select a language on the run. This requires more thought as after selection all open windows need to be refreshed so a restart or other routine is required.
This is the point at which I am now.
The standard language files can be downloaded here:-
https://www.dropbox.com/s/w6dk3wp7zhwq3 ... s.zip?dl=0
The Variable selector application can be downloaded here:-
https://www.dropbox.com/s/gc0lcqk2leogt ... r.zip?dl=0
I suggest you start by using the variable selector by opening a text editor then selecting various variables and pasteing them into the text editor to see what happens.
Once used to the idea you can with an existing application create a "Resources" folder copy the language files into this folder and add "Locale.pbi" to your project. In you main form add the code lines above and you are ready to start. You can then run the Variable selector and run through your application changing all literal strings to their variable equivalent. No application specific stuff done yet, that is next. Once all your strings have been replaced by variables your application will be multiligual!
These are not final yet so contain only a small selection of words to use in an application I will improve this over the next few days.
All suggestions etc recieved with thanks.
I would like.
A routine to store the 16X16 country flag in the language file. Each file is an SQLite database.
Any translations to other languages of the standard files. I can help by producing a standard text list of all words and phrases in their categories.
Any suggestions for further common word\phrases or categories.
Regards
CD