Sign in to follow this  
Followers 0
jlorenz1

Language file for allwoing multilanguage applications

4 posts in this topic

#1 ·  Posted (edited)

Hi,

it would be a great help to find a simply and solid solution how all captions & menus & messagetxts can be stored in one file (import for translating them) without using an overkill of variables and how they can be updated during runtime.

How this problem is been solved in other program languages? Thanks in advance Johannes

Edited by Valik
Removed obnoxious colors.

Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]

Share this post


Link to post
Share on other sites



First, don't use colored text for the entire post. It's obnoxious and hard to read with certain themes.

Second, why is this in the Feature Request forum? It's a support question, which is where I'm moving it to.

Share this post


Link to post
Share on other sites

First, don't use colored text for the entire post. It's obnoxious and hard to read with certain themes.

Second, why is this in the Feature Request forum? It's a support question, which is where I'm moving it to.

Sorry, Salik,

I don't agree with you. My intention is that language files should be build-in function in autoit, which allows easilier to change the captions & messages in one central file and with the option of changing the language during the runtime without restarting the application.

I tried it successfull with au3. script, but it was complex (for each message and control a global variable) and the changing of language worked only after restarting the program. The perfomance was reduced. I prefer to change it during the runtime of a program and without a reduced performance. Is this to complicated to understand? Don't be angry ... Johannes


Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]

Share this post


Link to post
Share on other sites

Sorry, Salik,

I don't agree with you. My intention is that language files should be build-in function in autoit, which allows easilier to change the captions & messages in one central file and with the option of changing the language during the runtime without restarting the application.

I tried it successfull with au3. script, but it was complex (for each message and control a global variable) and the changing of language worked only after restarting the program. The perfomance was reduced. I prefer to change it during the runtime of a program and without a reduced performance. Is this to complicated to understand? Don't be angry ... Johannes

put all the language specific strings into a multidimensional array and then switch the "language index" to the array.

Const $LANG_EN = 1
Const $LANG_OTHER = 2

DIM $ERROR_MSGS[3][20]
DIM $TITLE_MSGS[3][20]


Const $ERR_MSG_CANNOT_OPEN_FILE = 1
Const $ERR_MSG_CANNOT_WRITE_FILE = 2

$ERROR_MSGS[$LANG_EN][$ERR_MSG_CANNOT_OPEN_FILE] = "Error: Cannot open file"
$ERROR_MSGS[$LANG_EN][$ERR_MSG_CANNOT_OPEN_FILE] = "Error: Cannot write file"

$ERROR_MSGS[$LANG_OTHER][$ERR_MSG_CANNOT_OPEN_FILE] = "[OTHER LANG] Error: Cannot open file"
$ERROR_MSGS[$LANG_OTHER][$ERR_MSG_CANNOT_OPEN_FILE] = "[OTHER LANG] Error: Cannot write file"

Const $TITLE_MSG_ERROR = 1
Const $TITLE_MSG_WARNING = 2

$TITLE_MSGS[$LANG_EN][$TITLE_MSG_ERROR] = "Error"
$TITLE_MSGS[$LANG_EN][$TITLE_MSG_WARNING] = "Warning"

$TITLE_MSGS[$LANG_OTHER][$TITLE_MSG_ERROR] = "[OTHER LANG] Error"
$TITLE_MSGS[$LANG_OTHER][$TITLE_MSG_WARNING] = "[OTHER LANG] Warning"

$CURRENT_LANG = $LANG_EN
MsgBox(0,$TITLE_MSGS[$CURRENT_LANG][$TITLE_MSG_ERROR],$ERROR_MSGS[$CURRENT_LANG][$ERR_MSG_CANNOT_OPEN_FILE])

$CURRENT_LANG = $LANG_OTHER
MsgBox(0,$TITLE_MSGS[$CURRENT_LANG][$TITLE_MSG_ERROR],$ERROR_MSGS[$CURRENT_LANG][$ERR_MSG_CANNOT_OPEN_FILE])

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0