Locales in Phrase | Locales in Android, Locales found in requests
en | en_HK
ja | ja_JP
ko | ko_KR
zh-Hans | zh_CN_#Hans
zh-Hant | zh_HK_#Hant
When I try to request the translation xml
with the link containing the locale value zh_HK_#Hant
,
https://ota.phraseapp.com/DISTRIBUTION_ID/DEV_SECRET/zh_HK_#Hant/xml?
,
a 404 Not Found error is returned.
After checking with Phrase support
,
they found out the locale codes in the requests do not match the codes using in the project.
It seems Android added the location
to the locale code, i.e. _HK
in en_HK
.
For English
, Japanese
, Korean
, Phrase OTA can get the translation xml
correctly even the location is included in the locale code,
i.e. Phrase OTA can handle to redirection from the url
with en_HK
, ja_JP
, ko_KR
to translation xml
for English
, Japanese
, Korean
.
It ONLY failed for Simplified Chinese and Traditional Chinese.
Then I have called the Phrase.setLocaleCode
to update the locale to zh-Hans
/ zh-Hant
,
enforcing Phrase OTA
to get the correct translation xml
for Simplified Chinese / Traditional Chinese.
However, I found that after calling Phease.setLocaleCode
with zh-Hans
/ zh-Hant
,
some UI components cannot be completely translated,
see the Day of Week
row, Cancel
/ OK
buttons for DatePicker
,
which they should be displayed in Chinese
instead of English
.
![image](https://user-images.githubusercontent.com/104979030/166956397-e4cf738a-2752-4ae8-9d93-654f06c433c6.png)
In short, I have to set the locale with Phrase.setLocaleCode("zh-Hant") to fetch the translation xml.
However, Phrase.setLocaleCode(“zh-Hant”)
may change the locale settings in Android context
which broke the localization in DatePicker.