NativeScript / NativeScript/plugins

Android and iOS Application's language does not match

オープン
#533 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
206
フォーク
123
平均マージ
2日 1時間
マージ済み PR(30日)
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. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、示されている Device.language、device.language、ApplicationSettings.getString('app__language')、overrideLocale の呼び出しを使用して、Android と iOS で不一致を再現します。デバイスの言語を変更した後と、ロケールを手動で上書きした後に返される値を比較します。原因を特定し、Issue で期待されている iOS の動作を修正するか、明確に文書化できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, ios, typescript
領域
localization, mobile-dev
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。