我现在正在创建一个安卓应用程序,尝试为我的本地语言添加语言文件。但是以某种方式这对我没有起作用,在两个不同的手机上加载应用程序并得到相同的结果。之前曾经成功地创建了语言文件,但这次没有成功。(手机设置为瑞典语,语言文件对我创建的其他应用程序有效。)
在我的项目中,我已经:
目标语言是瑞典语(se),但我无法找出为什么这个应用程序对我不起作用。
values/strings.xml 文件。
在我的项目中,我已经:
res
values
strings.xml
style.xml
values-se
strings.xml
[more not values folder]
目标语言是瑞典语(se),但我无法找出为什么这个应用程序对我不起作用。
values/strings.xml 文件。
<?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\nfigaro@evigfilosofi.se</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>
在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\nfigaro@evigfilosofi.se</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>
这两个文件的类型都是 utf-8 (notepad++ 显示),我还尝试用瑞典语言文件替换英文副本,这也起作用了。从我的观察中,系统只选择默认语言文件和自定义文件?
有人知道为什么这对我不起作用吗?
se
却能正常工作,或者出现一些奇怪的错误... - FIG-GHD742