Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I need to do anything special to use Chinese in my Strings.xml?

I'm trying to add a Chinese version of my Strings.xml (into a project that already has an English and Spanish versions), and the app is simply crashing onlaunch, unable to even inflate the file. I'm assuming that there's some sort of encoding problem that I'm not taking into consideration, but I'm totally unfamiliar with what the requirements are to do this, so, am totally clueless as to what I should be doing to make this work.

I am setting my language to ch (perhaps this is not correct?) and the folder that the Strings.xml is in as values-ch. There is only one (test) string in the file which looks like this:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="q2_sp">請選擇您的語言。(英語/繁體中文)</string>

If I don't set the language to Chinese, it all continues to work fine (so the file is not corrupt) but when I set the language to chinese the app crashes on launch with a stack trace that complains about being unable to inflate the file. I can paste the stacktrace in if it's helpful, but am hoping that there's just something obvious I'm overlooking.

All help appreciated.

like image 310
Yevgeny Simkin Avatar asked Feb 19 '23 16:02

Yevgeny Simkin


1 Answers

"ch" for Switzerland, for Chinese use "zh"

like image 63
silentnuke Avatar answered Apr 27 '23 06:04

silentnuke