NativeScript / NativeScript/plugins

Android and iOS Application's language does not match

未关闭
#533 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
TypeScript
星标
206
派生
123
平均合并
2 天 1 小时
30 天内合并 PR
1

描述

I have implemented the localize plugin, and Im' facing issues:

"get the default language on user's phone via the language property of the Device class."

I have Android which phone language setting is set United Kingdom (en) this picks up correctly. On iOS I also have the setting language to English as preferred language but this isn't printing correctly. I the following code.

    console.log('DEVICE LANGUAGE', device.language);
    console.log('From Cores, Device.language);
    console.log('from __app__language__', ApplicationSettings.getString('__app__language__'))
    const localeOverriddenSuccessfully = overrideLocale(Device.language); 

On Android is correct:
Screenshot 2023-09-29 at 11 45 25

On iOS is incorrect:
Screenshot 2023-09-29 at 11 45 10
Screenshot 2023-09-29 at 11 43 00

ns --version
8.5.3
✔ Up to date.

Angular:
ng version

 _                      _                 ____ _     ___
/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

/ △ \ | '_ \ / | | | | |/ _ | '__| | | | | | |
/ ___ | | | | (
| | || | | (| | | | || | | |
// __| ||_, |_,||_,|| _|||
|___/

Angular CLI: 15.2.8
Node: 20.4.0 (Unsupported)
Package Manager: npm 9.7.2
OS: darwin x64

Angular: 15.1.5
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.1501.6
@angular-devkit/build-angular 15.1.6
@angular-devkit/core 15.1.6
@angular-devkit/schematics 15.2.8
@angular/cli 15.2.8
@ngtools/webpack 15.1.6
@schematics/angular 15.2.8
rxjs 7.6.0
typescript 4.8.4

=============================================
It seems to me that on iOS some how it cached into the the phone's default language variables, earlier on I was manually updating the language like so:
const localeOverriddenSuccessfully = overrideLocale('nl');
could this have been cached for iOS on this variables prior?

device.language
Device.language
__app__language__

Thanks

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,使用所示的 Device.language、device.language、ApplicationSettings.getString('app__language') 和 overrideLocale 调用,在 Android 和 iOS 上重现该差异。分别在更改设备语言后以及手动覆盖 locale 后比较返回值;完成的标准是确定原因,并修复 issue 预期的 iOS 行为或将其清楚地记录下来。

由索引模型根据 Issue 内容生成。

评估

技术栈
android, ios, typescript
领域
localization, mobile-dev
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。