如何修改android中的默认区域设置?
默认情况下,android系统的默认位置是US,语言是en。 但我想将默认位置设置为另一个国家/地区。因此,用户在第一次启动 android 时将看到他们的母语。
我尝试修改代码(/dalvik/libcore/luni/src/main/java/java/util/Locale.java
),更改区域设置的默认值。但没有效果。
你能告诉我如何设置默认位置吗?
*我想制作一个android镜像,然后将其刻录到设备上,当android第一次启动时,我希望它的操作系统语言不是英语而是另一种语言。
By default, the android system's default location is US and language is en.
But I want to set the default location to another country. So, the users will see their mother language when the first time startup android.
I have tried to modify the code(/dalvik/libcore/luni/src/main/java/java/util/Locale.java
), changed the locale's default value. But no effect.
Can you tell me how to set the default location?
*I want to make an android image, then burn it to the device, when the android starts up the first time, I want its os language is not English but another language.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
感谢大家的回复。
我找到了更改默认语言的方法。
只需修改
文件(build/core/Makefile)
。将
PRODUCT_DEFAULT_LANGUAGE
和PRODUCT_DEFAULT_REGION
设置为您想要设置的内容。thanks for all you reply.
i have found the method to change the default language.
just modify the
file(build/core/Makefile)
.set
PRODUCT_DEFAULT_LANGUAGE
andPRODUCT_DEFAULT_REGION
to what you want to set.我通过 build/target/product/core.mk 进行客户构建
示例:
This is what i do to make a simplified-chinese customer build.
I make customer build via build/target/product/core.mk
Samples:
This is what i do to make a simplified-chinese customer build.
最简单的方法可能是在启动前插入本地 SIM 卡。但就我而言,即使那样,时区也不会自动设置。
对于 lineage 18,首次启动设置,自定义构建:
将基本区域设置添加为
build/target/product/full_base.mk
中PRODUCT_LOCALES
的顶部,例如PRODUCT_LOCALES := de_DE
通过 makefile 设置默认时区对我来说不起作用,但它可以在安装向导中对其进行硬编码。
因此,将
packages/apps/SetupWizard/src/org/lineageos/setupwizard/DateTimeActivity.java
中的第 84 行更改为mCurrentTimeZone = TimeZone.getDefault();
到:
mCurrentTimeZone = TimeZone.getTimeZone("Europe/Amsterdam");
首先通过浏览列表检查手头有哪些时区!
The easiest way might be to insert a local SIM before boot. But in my case the timezone wouldn't be set automagically not even then.
For lineage 18, first boot setup, custom build:
Add base locale as top on
PRODUCT_LOCALES
inbuild/target/product/full_base.mk
likePRODUCT_LOCALES := de_DE
To set the default timezone via makefiles didn't work for me, but it worked to hardcode it in the SetupWizard.
So change line 84 in
packages/apps/SetupWizard/src/org/lineageos/setupwizard/DateTimeActivity.java
frommCurrentTimeZone = TimeZone.getDefault();
to:
mCurrentTimeZone = TimeZone.getTimeZone("Europe/Amsterdam");
Check first which timezones are at hand by browsing the list!
您已经检查过这部分了吗?
它从 Locale.java 中的第 212 行开始。这是您设置默认值的部分吗?如果是这样,请张贴该位,以便我可以查看。
编辑:实际上,如果您可以将整个 Locale.java 发布到 Pastebin 上。 http://pastebin.com/
Have you already checked out this part?
It starts at line 212 in Locale.java. Is this the part where you've set your default values? If so then please post that bit up so I can check it out.
EDIT: Actually if you can post your whole Locale.java up on Pastebin. http://pastebin.com/
使用
java.util.locale
并使用方法
getISOcounty
、getISOLanguage
等...了解更多详细信息,请参阅
http://developer.android.com/reference/java/util/Locale。 html
Use
java.util.locale
and use method
getISOcounty
,getISOLanguage
etc...to know more in detail go through
http://developer.android.com/reference/java/util/Locale.html