Here's the code I used for PNotes/ATPad.
They set the language through a file name, not using the environmental variables or using international language codes.
GetAppLanguage:
ReadEnvStr $APPLANGUAGE "PortableApps.comLanguageCode"
StrCmp $APPLANGUAGE de Deutsch
StrCmp $APPLANGUAGE en_us English
StrCmp $APPLANGUAGE es_la Spanish
StrCmp $APPLANGUAGE it Italian
StrCmp $APPLANGUAGE jp Japanese
StrCmp $APPLANGUAGE pl Polski
StrCmp $APPLANGUAGE pt Portugese
StrCmp $APPLANGUAGE ru Russian English
Deutsch:
StrCpy $APPLANGUAGE deutsch
Goto GetCurrentLanguage
English:
StrCpy $APPLANGUAGE english
Goto GetCurrentLanguage
Spanish:
StrCpy $APPLANGUAGE spanish
Goto GetCurrentLanguage
Italian:
StrCpy $APPLANGUAGE italian
Goto GetCurrentLanguage
Japanese:
StrCpy $APPLANGUAGE japanese
Goto GetCurrentLanguage
Polski:
StrCpy $APPLANGUAGE polski
Goto GetCurrentLanguage
Portugese:
StrCpy $APPLANGUAGE portugese
Goto GetCurrentLanguage
Russian:
StrCpy $APPLANGUAGE russian
Goto GetCurrentLanguage
GetCurrentLanguage:
ReadINIStr $0 "$EXEDIR\Data\settings\Settings.ini" "lang" "Language"
StrCmp "$APPLANGUAGE.lng" $0 LaunchNow ;if the same, move on
IfFileExists "$EXEDIR\PNotes\lang\$APPLANGUAGE.lng" SetAppLanguage LaunchNow
SetAppLanguage:
WriteINIStr "$EXEDIR\Data\settings\Settings.ini" "lang" "Language""$APPLANGUAGE.lng"Anywho, thought you might like another coding tidbit.
- OliverK's blog
- Log in or register to post comments
Comments
you spelt language wrong on
you spelt language wrong on these lines:
was there some meaning to this, or was it a typo by lamer when writing the INI reading part of PNotes?
but anyway, enough of the criticism. thanks for this, its going into HM NIS Edit Portable as i write.
Criticism good, someone might
Criticism good, someone might not have caught it, like me :(.
Actually, I kinda generalized it from the instances in PNotes/ATPad. Anywho, thanks and I 'll fix it.