如何修改android中的默认区域设置?

发布于 2024-09-17 21:36:41 字数 293 浏览 3 评论 0原文

默认情况下,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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

海之角 2024-09-24 21:36:41

感谢大家的回复。

我找到了更改默认语言的方法。

只需修改文件(build/core/Makefile)

PRODUCT_DEFAULT_LANGUAGEPRODUCT_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 and PRODUCT_DEFAULT_REGION to what you want to set.

伪心 2024-09-24 21:36:41

我通过 build/target/product/core.mk 进行客户构建
示例:

PRODUCT_PROPERTY_OVERRIDES := \
    ro.config.notification_sound=OnTheHunt.ogg \
    ro.config.alarm_alert=Alarm_Classic.ogg \
    ro.config.ringtone=BirdLoop.ogg \
    persist.sys.language=zh \
    persist.sys.country=CN \
    persist.sys.timezone=Asia/Shanghai

This is what i do to make a simplified-chinese customer build.

I make customer build via build/target/product/core.mk
Samples:

PRODUCT_PROPERTY_OVERRIDES := \
    ro.config.notification_sound=OnTheHunt.ogg \
    ro.config.alarm_alert=Alarm_Classic.ogg \
    ro.config.ringtone=BirdLoop.ogg \
    persist.sys.language=zh \
    persist.sys.country=CN \
    persist.sys.timezone=Asia/Shanghai

This is what i do to make a simplified-chinese customer build.

凌乱心跳 2024-09-24 21:36:41

最简单的方法可能是在启动前插入本地 SIM 卡。但就我而言,即使那样,时区也不会自动设置。

对于 lineage 18,首次启动设置,自定义构建:

将基本区域设置添加为 build/target/product/full_base.mkPRODUCT_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 in build/target/product/full_base.mk like
PRODUCT_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 from
mCurrentTimeZone = TimeZone.getDefault();
to:
mCurrentTimeZone = TimeZone.getTimeZone("Europe/Amsterdam");

Check first which timezones are at hand by browsing the list!

巴黎盛开的樱花 2024-09-24 21:36:41

您已经检查过这部分了吗?

 private Locale() {
   languageCode = "en"; //$NON-NLS-1$
   countryCode = "US"; //$NON-NLS-1$
   variantCode = ""; //$NON-NLS-1$
 }

它从 Locale.java 中的第 212 行开始。这是您设置默认值的部分吗?如果是这样,请张贴该位,以便我可以查看。

编辑:实际上,如果您可以将整个 Locale.java 发布到 Pastebin 上。 http://pastebin.com/

Have you already checked out this part?

 private Locale() {
   languageCode = "en"; //$NON-NLS-1$
   countryCode = "US"; //$NON-NLS-1$
   variantCode = ""; //$NON-NLS-1$
 }

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/

醉态萌生 2024-09-24 21:36:41

使用 java.util.locale

并使用方法 getISOcountygetISOLanguage 等...

了解更多详细信息,请参阅
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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文