Reputation: 2486
I'm creating a android app now and try to add language file for my native language. But in some way this not work for me, has try to load the app in two different phone with same result. Has before create language file with good result but not this time. (The phone is set to Swedish and the language file work for other apps I has create.)
In my project I has
res
values
strings.xml
style.xml
values-se
strings.xml
[more not values folder]
The target language is Swedish (se), but I can't find out way this not work in this app for me.
The values/strings.xml file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">My Quick Notes</string>
<string name="delete_item">Delete this note?</string>
<string name="add_item">Add new note</string>
<string name="switch_note_mode">Switches notes mode</string>
<string name="text_about">About</string>
<string name="text_help">Help</string>
<string name="text_ok">Ok</string>
<string name="text_switch_mode">Switch Mode</string>
<string name="text_about_message" formatted="false">Created by Figaro\nA simple notepad app.\nCopyright © 2012\[email protected]</string>
<string name="text_help_message">A simple notepad app for make quick notes.\n
\nClick on the first note with the green plus chars for add a new note.\n
\nMy Quick Notes support mulit list mode as normal mode, bullet list and checkbox list.
\nThe checkbox mode can be use for create a check list and check off list. Click on the checkbox for toggle the checkbox.
</string>
</resources>
And values-se/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">My Quick Notes</string>
<string name="delete_item">Radera anteckning</string>
<string name="add_item">Ny anteckning</string>
<string name="switch_note_mode">Växa anteckningsläge</string>
<string name="text_about">Om</string>
<string name="text_help">Hjälp</string>
<string name="text_ok">Ok</string>
<string name="text_switch_mode">Växla Läge</string>
<string name="text_about_message" formatted="false">Skapad av Figaro\nEn enkel antecknings app\nCopyright © 2012\[email protected]</string>
<string name="text_help_message" formatted="false">En enkel notepad för att snabbt göra anteckningar\n
\nKlicka på den första noten med grönt plustecken för att skapa en ny anteckning.\n
\nMy Quick Notes stöder flera list lägen så som normalt läge, punktlista och checkboxlista\n
\nCheckbox läge kan användas för att skapa checklistor som kan prickas av. Klicka på checkrutan för att ändra den.
</string>
</resources>
Both files is of type utf-8 (notepad++ say it), I has also try to replace the English copy with the Swedish language file and this work, and what I can see, the system only select the default language file and the custom files?
Somebody that know way this not work for me?
Upvotes: 4
Views: 2578
Reputation: 452
from android documentation
The language is defined by a two-letter ISO 639-1 language code, optionally followed by a two letter ISO 3166-1-alpha-2 region code (preceded by lowercase r).
The codes are not case-sensitive; the r prefix is used to distinguish the region portion. You cannot specify a region alone.
Upvotes: 0
Reputation: 9375
You're using the Sweden top level domain name abbreviation, which is not what you're supposed to use in this case.
The Android localization code for Swedish from Sweden is values-sv-rSE
sv
is the actual code for the language Swedish
Upvotes: 4