# Multilanguage

**URL:** <https://forum.xojo.com/t/multilanguage/22474>\
**Category:** General\
**Created:** [February 19, 2015, 12:41pm UTC](https://forum.xojo.com/t/multilanguage/22474 "2015-02-19T12:41:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sascha\_Mierke](https://forum.xojo.com/user_avatar/forum.xojo.com/sascha_mierke/32/8250_2.png) [@Sascha\_Mierke](https://forum.xojo.com/u/Sascha_Mierke)\
**Post date:** [February 19, 2015, 12:41pm UTC](https://forum.xojo.com/t/multilanguage/22474/1 "2015-02-19T12:41:10Z")

</div>

Hi there,

i’ve got some question about different languages in my app. I used default as English and German as German language. Is there a possibility to test this settings? Can i start the app with another language?

---

<div class="post-metadata">

**Author:** ![Markus\_Winter](https://forum.xojo.com/user_avatar/forum.xojo.com/markus_winter/32/144_2.png) [@Markus\_Winter](https://forum.xojo.com/u/Markus_Winter)\
**Post date:** [February 19, 2015, 12:45pm UTC](https://forum.xojo.com/t/multilanguage/22474/2 "2015-02-19T12:45:58Z")

</div>

If you are on a Mac then simply change the system language before starting your app.

---

<div class="post-metadata">

**Author:** ![Sascha\_Mierke](https://forum.xojo.com/user_avatar/forum.xojo.com/sascha_mierke/32/8250_2.png) [@Sascha\_Mierke](https://forum.xojo.com/u/Sascha_Mierke)\
**Post date:** [February 19, 2015, 1:13pm UTC](https://forum.xojo.com/t/multilanguage/22474/3 "2015-02-19T13:13:15Z")

</div>

hm that is an idea but i dont want to restart the mac all the time ☹

---

<div class="post-metadata">

**Author:** ![Markus\_Winter](https://forum.xojo.com/user_avatar/forum.xojo.com/markus_winter/32/144_2.png) [@Markus\_Winter](https://forum.xojo.com/u/Markus_Winter)\
**Post date:** [February 19, 2015, 1:17pm UTC](https://forum.xojo.com/t/multilanguage/22474/4 "2015-02-19T13:17:40Z")

</div>

You don’t have to restart the Mac, just your app.

---

<div class="post-metadata">

**Author:** ![Markus\_Winter](https://forum.xojo.com/user_avatar/forum.xojo.com/markus_winter/32/144_2.png) [@Markus\_Winter](https://forum.xojo.com/u/Markus_Winter)\
**Post date:** [February 19, 2015, 1:18pm UTC](https://forum.xojo.com/t/multilanguage/22474/5 "2015-02-19T13:18:57Z")

</div>

When the app starts it checks whiat the system language is set to. So it is not important what the system language actually is, just what it is set to.

---

<div class="post-metadata">

**Author:** ![Markus\_Winter](https://forum.xojo.com/user_avatar/forum.xojo.com/markus_winter/32/144_2.png) [@Markus\_Winter](https://forum.xojo.com/u/Markus_Winter)\
**Post date:** [February 19, 2015, 1:20pm UTC](https://forum.xojo.com/t/multilanguage/22474/6 "2015-02-19T13:20:58Z")

</div>

Btw how about setting your location in your profile? I akways like when I know to which country/city I’m talking to.

---

<div class="post-metadata">

**Author:** ![Massimo\_Valle](https://forum.xojo.com/user_avatar/forum.xojo.com/massimo_valle/32/23049_2.png) [@Massimo\_Valle](https://forum.xojo.com/u/Massimo_Valle)\
**Post date:** [February 19, 2015, 1:26pm UTC](https://forum.xojo.com/t/multilanguage/22474/7 "2015-02-19T13:26:23Z")

</div>

> [@168968:@Markus Winter](#):
>
> If you are on a Mac then simply change the system language before starting your app.

A simpler hack is to swap names the package folders “en.lproj” in Resources folder.  
Example swap “en.lproj” with “de.lproj”

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [February 19, 2015, 1:30pm UTC](https://forum.xojo.com/t/multilanguage/22474/8 "2015-02-19T13:30:32Z")

</div>

Just one word (I always wanted to try that): LangSwitch.

---

<div class="post-metadata">

**Author:** ![Sascha\_Mierke](https://forum.xojo.com/user_avatar/forum.xojo.com/sascha_mierke/32/8250_2.png) [@Sascha\_Mierke](https://forum.xojo.com/u/Sascha_Mierke)\
**Post date:** [February 19, 2015, 1:53pm UTC](https://forum.xojo.com/t/multilanguage/22474/9 "2015-02-19T13:53:44Z")

</div>

hm the interesting part is, msgboxes dont work with this languages constants o.O

---

<div class="post-metadata">

**Author:** ![Markus\_Winter](https://forum.xojo.com/user_avatar/forum.xojo.com/markus_winter/32/144_2.png) [@Markus\_Winter](https://forum.xojo.com/u/Markus_Winter)\
**Post date:** [February 19, 2015, 1:56pm UTC](https://forum.xojo.com/t/multilanguage/22474/10 "2015-02-19T13:56:29Z")

</div>

[quote=168981:@Massimo Valle]A simpler hack is to swap names the package folders “en.lproj” in Resources folder.  
Example swap “en.lproj” with “de.lproj”[/quote]  
No, that is not easier.

---

<div class="post-metadata">

**Author:** ![Sascha\_Mierke](https://forum.xojo.com/user_avatar/forum.xojo.com/sascha_mierke/32/8250_2.png) [@Sascha\_Mierke](https://forum.xojo.com/u/Sascha_Mierke)\
**Post date:** [February 19, 2015, 1:57pm UTC](https://forum.xojo.com/t/multilanguage/22474/11 "2015-02-19T13:57:00Z")

</div>

Ah wrong alarm, just forget to set the dynamic option … xD

---

<div class="post-metadata">

**Author:** ![Markus\_Winter](https://forum.xojo.com/user_avatar/forum.xojo.com/markus_winter/32/144_2.png) [@Markus\_Winter](https://forum.xojo.com/u/Markus_Winter)\
**Post date:** [February 19, 2015, 1:58pm UTC](https://forum.xojo.com/t/multilanguage/22474/12 "2015-02-19T13:58:48Z")

</div>

[quote=168981:@Massimo Valle]A simpler hack is to swap names the package folders “en.lproj” in Resources folder.  
Example swap “en.lproj” with “de.lproj”[/quote]  
No, that is not easier.

Leave the system Preferences open, set the language to Deutsch. Restart your app. It’s in German.

Set the language to French. Restart your app. It’s in French.

Etc.

No need to muck around inside the app bundle.

---

<div class="post-metadata">

**Author:** ![Axel\_Schneider](https://forum.xojo.com/user_avatar/forum.xojo.com/axel_schneider/32/465_2.png) [@Axel\_Schneider](https://forum.xojo.com/u/Axel_Schneider)\
**Post date:** [February 19, 2015, 1:59pm UTC](https://forum.xojo.com/t/multilanguage/22474/13 "2015-02-19T13:59:51Z")

</div>

in OSX you can start your app from Terminal with different language

/Applications/yourApp.app/Contents/MacOS/yourApp -AppleLanguages ‘(en)’

/Applications/yourApp.app/Contents/MacOS/yourApp -AppleLanguages ‘(de)’

---

<div class="post-metadata">

**Author:** ![Oliver\_Osswald](https://forum.xojo.com/user_avatar/forum.xojo.com/oliver_osswald/32/6972_2.png) [@Oliver\_Osswald](https://forum.xojo.com/u/Oliver_Osswald)\
**Post date:** [February 19, 2015, 3:01pm UTC](https://forum.xojo.com/t/multilanguage/22474/14 "2015-02-19T15:01:46Z")

</div>

Nice for testing an app in different languages:  
[http://tj-hd.co.uk/en-gb/languageswitcher/](http://tj-hd.co.uk/en-gb/languageswitcher/)

![](http://osswald.com/xojo/langswitch.png)

---

<div class="post-metadata">

**Author:** ![Oliver\_Osswald](https://forum.xojo.com/user_avatar/forum.xojo.com/oliver_osswald/32/6972_2.png) [@Oliver\_Osswald](https://forum.xojo.com/u/Oliver_Osswald)\
**Post date:** [February 19, 2015, 3:09pm UTC](https://forum.xojo.com/t/multilanguage/22474/15 "2015-02-19T15:09:42Z")

</div>

Or (still Mac only) you could add an AppleScript to your app which the user can call from a menu or pushbutton, which allows him to select a language of his choice (Change “Cashbook Pro” to your app name):

[code]–Autor: Kudusch  
–Licence: CC BY-NC

–set the Application you want to work with  
set vInput to “Cashbook Pro”

–Path and BundleID of application are safed in variables  
try  
set vPath to (path to application vInput) as string  
set vBundle to bundle identifier of (info for (path to application vInput))  
on error  
error “You must choose an application!”  
end try  
set vPath to (path to application vInput) as string  
set vBundle to bundle identifier of (info for (path to application vInput))

–check available localizations  
tell application “Finder”  
set vOut to {}  
set vFolder to vPath & “Contents:Resources:” as string as alias  
try  
set vList to name of every folder in vFolder  
on error  
error “There are no localizations available!”  
end try  
set vList to name of every folder in vFolder  
set n to 1  
repeat while n ? (count items in vList)  
set vTr to item n of vList  
set AppleScript’s text item delimiters to {"."}  
set vTr to every text item in vTr as list  
if (count every item of vTr) \> 1 and item 2 of vTr = “lproj” then  
set AppleScript’s text item delimiters to {""}  
set vOut to ((item 1 of vTr as list) & vOut)  
end if  
set n to n + 1  
end repeat  
end tell

–user chooses language  
set dialog2 to choose from list vOut with prompt “Cashbook Pro language:”  
set vLang to dialog2  
if vLang = false then  
error number -128  
end if  
set vLang to item 1 of vLang as text  
–language is changed  
set vScript to “defaults write " & vBundle & " AppleLanguages '(” & vLang & “)’”  
do shell script vScript  
tell application vInput to quit  
delay 2  
tell application vInput to activate[/code]

---

<div class="post-metadata">

**Author:** ![Sascha\_Mierke](https://forum.xojo.com/user_avatar/forum.xojo.com/sascha_mierke/32/8250_2.png) [@Sascha\_Mierke](https://forum.xojo.com/u/Sascha_Mierke)\
**Post date:** [February 19, 2015, 7:08pm UTC](https://forum.xojo.com/t/multilanguage/22474/16 "2015-02-19T19:08:27Z")

</div>

hm it seems that i have to build the app on english now. If i build it on german i got only german language o.o

---

<div class="post-metadata">

**Author:** ![Markus\_Winter](https://forum.xojo.com/user_avatar/forum.xojo.com/markus_winter/32/144_2.png) [@Markus\_Winter](https://forum.xojo.com/u/Markus_Winter)\
**Post date:** [February 19, 2015, 7:10pm UTC](https://forum.xojo.com/t/multilanguage/22474/17 "2015-02-19T19:10:07Z")

</div>

Have you moved English to the top of the languages?

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [February 19, 2015, 7:12pm UTC](https://forum.xojo.com/t/multilanguage/22474/18 "2015-02-19T19:12:09Z")

</div>

“default” isn’t a language  
it literally means “whatever language your OS is running right now” when you build

If you want to use dynamic constants to localize you _should_ add one for EVERY language you intend to support  
So if you expect to support English & German then you should have “default” set to something, and an entry for English & one for German  
Then regardless of what platform or language setting you are on when you build you will get a german & english localization

IF however you only have “default” and German and you’re currently running German then you’r app is in German only

---

<div class="post-metadata">

**Author:** ![Markus\_Winter](https://forum.xojo.com/user_avatar/forum.xojo.com/markus_winter/32/144_2.png) [@Markus\_Winter](https://forum.xojo.com/u/Markus_Winter)\
**Post date:** [February 19, 2015, 7:12pm UTC](https://forum.xojo.com/t/multilanguage/22474/19 "2015-02-19T19:12:16Z")

</div>

Actually, have you added English as a localized language? If not then it will use the languages you have in your order of preference.

The computer does NOT know that your default is in English.

It uses default when it can’t find any of the other languages in your preferred languages list. As German is in your list it uses that when it doesn’t find English.

---

<div class="post-metadata">

**Author:** ![Markus\_Winter](https://forum.xojo.com/user_avatar/forum.xojo.com/markus_winter/32/144_2.png) [@Markus\_Winter](https://forum.xojo.com/u/Markus_Winter)\
**Post date:** [February 19, 2015, 7:14pm UTC](https://forum.xojo.com/t/multilanguage/22474/20 "2015-02-19T19:14:18Z")

</div>

Windows question: if you have multiple languages installed, and you change the language in the control panel, will the app then use the new language setting or is a restart required? In other words: is the setting important, or the currently running system language?

[Next page](https://forum.xojo.com/t/multilanguage/22474.md?page=2)
