python / python/cpython

Support `locale` module on Android

オープン
#135,753 コメント 0 件 リアクション 3 件 担当者 0 名 GitHub で見る

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

OS-android stdlib type-feature
主要言語
Python
スター
77.2k
フォーク
36k
PR マージ指標
PR 指標を取得中

説明

Migrated from https://github.com/chaquo/chaquopy/issues/1150:


From https://github.com/beeware/toga/discussions/2562:

Hello, how can I recognize the current language with locale.getlocale()?
When i try it on android, it only returns ('en_US', 'UTF-8'), even if default language was set to an other language.

I don't think Android sets any of the standard LC_... environment variables, probably because it supports changing the locale within the lifetime of a single process. Instead, it provides an Android-specific API:

context.getResources().getConfiguration().getLocales().get(0)

This will return a string in the form en_US, which can be passed to locale.setlocale.

The difficult part is getting a reference to the context object. For details, see https://github.com/python/cpython/issues/90371#issuecomment-2991401118.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Python の locale モジュールと、issue にリンクされている Android コンテキストのガイダンスから始めます。特定のファイルやテストは指定されていません。Android の現在の locale にアクセスする方法を確認し、locale.getlocale() が常に en_US を返すのではなく、それを反映することを検証しながら、locale.setlocale との互換性を維持してください。

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

評価

技術スタック
android, python
領域
mobile-dev
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

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

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