-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/multilanguage #177
Feat/multilanguage #177
Conversation
Walkthroughこのプルリクエストでは、QGISプラグインの国際化を強化するために、英語と日本語の翻訳ファイルを新たに追加しました。また、ユーザーインターフェースの改善として、新しいボタンやメッセージの翻訳機能が実装され、ユーザーがより良い体験を得られるようにしました。さらに、プロジェクトファイルが追加され、プラグインのビルド構成が整理されました。 Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Application
participant Translator
participant UI
User->>Application: 起動
Application->>Translator: ユーザーのロケールを取得
Translator->>Application: 翻訳ファイルを読み込む
Application->>UI: UIを表示
User->>UI: ボタンをクリック
UI->>Application: アクションを実行
Application->>UI: 結果を表示
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (2)
Files skipped from review as they are similar to previous changes (2)
TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (9)
- i18n/QGIS2PlugX_en.ts (1 hunks)
- i18n/QGIS2PlugX_ja.ts (1 hunks)
- qgis2plugx.pro (1 hunks)
- qgis2plugx.py (2 hunks)
- translator/thread.py (2 hunks)
- ui/main_dialog.py (6 hunks)
- ui/main_dialog.ui (4 hunks)
- ui/progress_dialog.py (3 hunks)
- ui/progress_dialog.ui (3 hunks)
Files skipped from review due to trivial changes (2)
- ui/main_dialog.ui
- ui/progress_dialog.ui
Additional context used
Ruff
translator/thread.py
8-8:
ui.progress_dialog.ProgressDialog
imported but unusedRemove unused import:
ui.progress_dialog.ProgressDialog
(F401)
ui/main_dialog.py
169-169: f-string without any placeholders
Remove extraneous
f
prefix(F541)
GitHub Check: Lint
translator/thread.py
[failure] 8-8: Ruff (F401)
translator/thread.py:8:32: F401ui.progress_dialog.ProgressDialog
imported but unusedui/main_dialog.py
[failure] 169-169: Ruff (F541)
ui/main_dialog.py:169:16: F541 f-string without any placeholders
Biome
i18n/QGIS2PlugX_en.ts
[error] 1-1: Expected a type but instead found '?'.
Expected a type here.
(parse)
[error] 1-1: expected
:
but instead foundversion
Remove version
(parse)
[error] 1-1: Expected a semicolon or an implicit semicolon after a statement, but found none
An explicit or implicit semicolon is expected here...
...Which is required to end this statement
(parse)
[error] 1-1: Expected an expression for the left hand side of the
>
operator.This operator requires a left hand side value
(parse)
[error] 2-2: Expected a type but instead found '!'.
Expected a type here.
(parse)
[error] 2-2: expected
:
but instead foundTS
Remove TS
(parse)
[error] 2-2: expected
>
but instead foundversion
Remove version
(parse)
[error] 2-2: Invalid assignment to
TS><TS version
This expression cannot be assigned to
(parse)
[error] 4-4: unterminated regex literal
...but the line ends here
a regex literal starts there...
(parse)
[error] 6-6: expected
>
but instead foundfilename
Remove filename
(parse)
[error] 2-6: Invalid assignment to
"2.0"> <context> <name>Dialog</name> <message> <location filename
This expression cannot be assigned to
(parse)
[error] 6-6: Expected a semicolon or an implicit semicolon after a statement, but found none
An explicit or implicit semicolon is expected here...
...Which is required to end this statement
(parse)
[error] 6-6: Expected an expression but instead found '>'.
Expected an expression here.
(parse)
[error] 7-7: unterminated regex literal
...but the line ends here
a regex literal starts there...
(parse)
[error] 8-8: Expected a semicolon or an implicit semicolon after a statement, but found none
An explicit or implicit semicolon is expected here...
...Which is required to end this statement
(parse)
[error] 8-8: Expected a type but instead found '/'.
Expected a type here.
(parse)
[error] 8-8: unterminated regex literal
...but the line ends here
a regex literal starts there...
(parse)
[error] 9-9: unterminated regex literal
...but the line ends here
a regex literal starts there...
(parse)
[error] 11-11: expected
>
but instead foundfilename
Remove filename
(parse)
[error] 8-11: Invalid assignment to
"unfinished"></translation> </message> <message> <location filename
This expression cannot be assigned to
(parse)
i18n/QGIS2PlugX_ja.ts
[error] 1-1: Expected a type but instead found '?'.
Expected a type here.
(parse)
[error] 1-1: expected
:
but instead foundversion
Remove version
(parse)
[error] 1-1: Expected a semicolon or an implicit semicolon after a statement, but found none
An explicit or implicit semicolon is expected here...
...Which is required to end this statement
(parse)
[error] 1-1: Expected an expression for the left hand side of the
>
operator.This operator requires a left hand side value
(parse)
[error] 2-2: Expected a type but instead found '!'.
Expected a type here.
(parse)
[error] 2-2: expected
:
but instead foundTS
Remove TS
(parse)
[error] 3-3: expected
>
but instead foundversion
Remove version
(parse)
[error] 2-3: Invalid assignment to
TS> <TS version
This expression cannot be assigned to
(parse)
[error] 3-3: Expected a semicolon or an implicit semicolon after a statement, but found none
An explicit or implicit semicolon is expected here...
...Which is required to end this statement
(parse)
[error] 5-5: unterminated regex literal
...but the line ends here
a regex literal starts there...
(parse)
[error] 7-7: expected
>
but instead foundfilename
Remove filename
(parse)
[error] 3-7: Invalid assignment to
"ja"> <context> <name>Dialog</name> <message> <location filename
This expression cannot be assigned to
(parse)
[error] 7-7: Expected a semicolon or an implicit semicolon after a statement, but found none
An explicit or implicit semicolon is expected here...
...Which is required to end this statement
(parse)
[error] 7-7: Expected an expression but instead found '>'.
Expected an expression here.
(parse)
[error] 8-8: unterminated regex literal
...but the line ends here
a regex literal starts there...
(parse)
[error] 9-9: Expected a semicolon or an implicit semicolon after a statement, but found none
An explicit or implicit semicolon is expected here...
...Which is required to end this statement
(parse)
[error] 9-9: Expected a type but instead found '/'.
Expected a type here.
(parse)
[error] 9-9: unterminated regex literal
...but the line ends here
a regex literal starts there...
(parse)
[error] 10-10: unterminated regex literal
...but the line ends here
a regex literal starts there...
(parse)
[error] 12-12: expected
>
but instead foundfilename
Remove filename
(parse)
Additional comments not posted (16)
qgis2plugx.pro (1)
1-7
: LGTM!プロジェクトファイルの変更は問題ありません。ソースファイル、UIファイル、翻訳ファイルが正しく指定されています。
translator/thread.py (1)
58-58
: LGTM!処理中のメッセージを日本語から英語に変更したことで、アプリケーションが両方の言語をサポートするというPRの目的に沿っています。
ui/progress_dialog.py (2)
28-32
: LGTM!UIテキストを英語に変更したことで、アプリケーションの国際化が向上しています。これらの変更により、インターフェースを異なる言語に容易に適応させることができます。
Also applies to: 43-51
65-74
: LGTM!新しい
translate
メソッドは、辞書を使用してメッセージの翻訳を容易にします。これは翻訳を処理するための良いアプローチです。qgis2plugx.py (3)
5-5
: LGTM!インポート文は正しく、ローカライゼーションの変更に必要です。
29-38
: LGTM!このコードセグメントは正しく実装されており、アプリケーションが翻訳ファイルで定義された翻訳を使用できるようにします。
39-40
: LGTM!
tr
メソッドは正しく実装されており、現在のロケールに基づいて文字列の動的な翻訳を可能にします。i18n/QGIS2PlugX_en.ts (1)
1-142
: LGTM!このファイルは、UIの要素とメッセージの英語翻訳を含む新しいXMLファイルです。静的解析ツールからのヒントは誤検知であり、無視できます。ファイルの追加を承認します。
Tools
Biome
[error] 1-1: Expected a type but instead found '?'.
Expected a type here.
(parse)
[error] 1-1: expected
:
but instead foundversion
Remove version
(parse)
[error] 1-1: Expected a semicolon or an implicit semicolon after a statement, but found none
An explicit or implicit semicolon is expected here...
...Which is required to end this statement
(parse)
[error] 1-1: Expected an expression for the left hand side of the
>
operator.This operator requires a left hand side value
(parse)
[error] 2-2: Expected a type but instead found '!'.
Expected a type here.
(parse)
[error] 2-2: expected
:
but instead foundTS
Remove TS
(parse)
[error] 2-2: expected
>
but instead foundversion
Remove version
(parse)
[error] 2-2: Invalid assignment to
TS><TS version
This expression cannot be assigned to
(parse)
[error] 4-4: unterminated regex literal
...but the line ends here
a regex literal starts there...
(parse)
[error] 6-6: expected
>
but instead foundfilename
Remove filename
(parse)
[error] 2-6: Invalid assignment to
"2.0"> <context> <name>Dialog</name> <message> <location filename
This expression cannot be assigned to
(parse)
[error] 6-6: Expected a semicolon or an implicit semicolon after a statement, but found none
An explicit or implicit semicolon is expected here...
...Which is required to end this statement
(parse)
[error] 6-6: Expected an expression but instead found '>'.
Expected an expression here.
(parse)
[error] 7-7: unterminated regex literal
...but the line ends here
a regex literal starts there...
(parse)
[error] 8-8: Expected a semicolon or an implicit semicolon after a statement, but found none
An explicit or implicit semicolon is expected here...
...Which is required to end this statement
(parse)
[error] 8-8: Expected a type but instead found '/'.
Expected a type here.
(parse)
[error] 8-8: unterminated regex literal
...but the line ends here
a regex literal starts there...
(parse)
[error] 9-9: unterminated regex literal
...but the line ends here
a regex literal starts there...
(parse)
[error] 11-11: expected
>
but instead foundfilename
Remove filename
(parse)
[error] 8-11: Invalid assignment to
"unfinished"></translation> </message> <message> <location filename
This expression cannot be assigned to
(parse)
i18n/QGIS2PlugX_ja.ts (1)
1-143
: LGTM!このファイルは、UIの要素とメッセージの日本語翻訳を含む新しいXMLファイルです。静的解析ツールからのヒントは誤検知であり、無視できます。ファイルの追加を承認します。
Tools
Biome
[error] 1-1: Expected a type but instead found '?'.
Expected a type here.
(parse)
[error] 1-1: expected
:
but instead foundversion
Remove version
(parse)
[error] 1-1: Expected a semicolon or an implicit semicolon after a statement, but found none
An explicit or implicit semicolon is expected here...
...Which is required to end this statement
(parse)
[error] 1-1: Expected an expression for the left hand side of the
>
operator.This operator requires a left hand side value
(parse)
[error] 2-2: Expected a type but instead found '!'.
Expected a type here.
(parse)
[error] 2-2: expected
:
but instead foundTS
Remove TS
(parse)
[error] 3-3: expected
>
but instead foundversion
Remove version
(parse)
[error] 2-3: Invalid assignment to
TS> <TS version
This expression cannot be assigned to
(parse)
[error] 3-3: Expected a semicolon or an implicit semicolon after a statement, but found none
An explicit or implicit semicolon is expected here...
...Which is required to end this statement
(parse)
[error] 5-5: unterminated regex literal
...but the line ends here
a regex literal starts there...
(parse)
[error] 7-7: expected
>
but instead foundfilename
Remove filename
(parse)
[error] 3-7: Invalid assignment to
"ja"> <context> <name>Dialog</name> <message> <location filename
This expression cannot be assigned to
(parse)
[error] 7-7: Expected a semicolon or an implicit semicolon after a statement, but found none
An explicit or implicit semicolon is expected here...
...Which is required to end this statement
(parse)
[error] 7-7: Expected an expression but instead found '>'.
Expected an expression here.
(parse)
[error] 8-8: unterminated regex literal
...but the line ends here
a regex literal starts there...
(parse)
[error] 9-9: Expected a semicolon or an implicit semicolon after a statement, but found none
An explicit or implicit semicolon is expected here...
...Which is required to end this statement
(parse)
[error] 9-9: Expected a type but instead found '/'.
Expected a type here.
(parse)
[error] 9-9: unterminated regex literal
...but the line ends here
a regex literal starts there...
(parse)
[error] 10-10: unterminated regex literal
...but the line ends here
a regex literal starts there...
(parse)
[error] 12-12: expected
>
but instead foundfilename
Remove filename
(parse)
ui/main_dialog.py (7)
5-6
: LGTM!変更は承認されました。
44-44
: LGTM!変更は承認されました。
104-106
: LGTM!変更は承認されました。
174-178
: LGTM!変更は承認されました。
180-182
: LGTM!変更は承認されました。
Line range hint
185-199
: LGTM!変更は承認されました。
332-336
: LGTM!変更は承認されました。
translator/thread.py
Outdated
@@ -5,6 +5,8 @@ | |||
from translator.vector.process import process_vector | |||
from translator.vector.label import generate_label_json | |||
|
|||
from ui.progress_dialog import ProgressDialog |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
未使用のインポートを削除してください。
from ui.progress_dialog import ProgressDialog
は使用されていないようです。コードをクリーンに保つために、未使用のインポートは削除することをお勧めします。
このdiffを適用して未使用のインポートを削除してください:
-from ui.progress_dialog import ProgressDialog
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
from ui.progress_dialog import ProgressDialog |
Tools
Ruff
8-8:
ui.progress_dialog.ProgressDialog
imported but unusedRemove unused import:
ui.progress_dialog.ProgressDialog
(F401)
GitHub Check: Lint
[failure] 8-8: Ruff (F401)
translator/thread.py:8:32: F401ui.progress_dialog.ProgressDialog
imported but unused
ui/main_dialog.py
Outdated
msg = self.tr("Process completed") | ||
msg += f"\n\n" | ||
msg += self.tr("Output folder") | ||
msg += f":\n{params['output_dir']}" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ですが、不要な f
プレフィックスを削除してください。
変更は承認されました。
ただし、静的解析ツールが指摘しているように、169行目の文字列には不要な f
プレフィックスがあります。
以下のdiffを適用して f
プレフィックスを削除してください:
- msg += f"\n\n"
+ msg += "\n\n"
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
msg = self.tr("Process completed") | |
msg += f"\n\n" | |
msg += self.tr("Output folder") | |
msg += f":\n{params['output_dir']}" | |
msg = self.tr("Process completed") | |
msg += "\n\n" | |
msg += self.tr("Output folder") | |
msg += f":\n{params['output_dir']}" |
Tools
Ruff
169-169: f-string without any placeholders
Remove extraneous
f
prefix(F541)
GitHub Check: Lint
[failure] 169-169: Ruff (F541)
ui/main_dialog.py:169:16: F541 f-string without any placeholders
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK : )
Issue
close #176
related #105 #163
変更内容:Description
Summary by CodeRabbit
新機能
バグ修正
ドキュメント