-
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
メッセージの多言語化 #21
メッセージの多言語化 #21
Conversation
Walkthroughこの変更は、JAXA Earth APIダイアログの国際化を強化し、英語と日本語のローカリゼーションを追加しました。また、データ処理とエラーメッセージの改善も行われました。 Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant User
participant JaxaEarthApiDialog
participant Translator
participant DataLoader
User ->> JaxaEarthApiDialog: Load Dataset
JaxaEarthApiDialog ->> Translator: Translate Error Messages
JaxaEarthApiDialog ->> DataLoader: Check Data Amount
DataLoader -->> JaxaEarthApiDialog: Data Count
alt Data Count > 0
JaxaEarthApiDialog ->> User: Confirm Load
User -->> JaxaEarthApiDialog: Confirm
JaxaEarthApiDialog ->> DataLoader: Load Images
else Data Count == 0
JaxaEarthApiDialog ->> User: No Feature Found
end
DataLoader -->> JaxaEarthApiDialog: Images or Error
JaxaEarthApiDialog ->> User: Display Images or Error
Assessment against linked issues
Tip New Features and ImprovementsReview SettingsIntroduced new personality profiles for code reviews. Users can now select between "Chill" and "Assertive" review tones to tailor feedback styles according to their preferences. The "Assertive" profile posts more comments and nitpicks the code more aggressively, while the "Chill" profile is more relaxed and posts fewer comments. AST-based InstructionsCodeRabbit offers customizing reviews based on the Abstract Syntax Tree (AST) pattern matching. Read more about AST-based instructions in the documentation. Community-driven AST-based RulesWe are kicking off a community-driven initiative to create and share AST-based rules. Users can now contribute their AST-based rules to detect security vulnerabilities, code smells, and anti-patterns. Please see the ast-grep-essentials repository for more information. New Static Analysis ToolsWe are continually expanding our support for static analysis tools. We have added support for Tone SettingsUsers can now customize CodeRabbit to review code in the style of their favorite characters or personalities. Here are some of our favorite examples:
Revamped Settings PageWe have redesigned the settings page for a more intuitive layout, enabling users to find and adjust settings quickly. This change was long overdue; it not only improves the user experience but also allows our development team to add more settings in the future with ease. Going forward, the changes to Miscellaneous
Tip Early Access Features
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 as PR comments)
Additionally, you can add CodeRabbit Configration 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
Outside diff range and nitpick comments (2)
i18n/jaxaEarthApi_en.ts (1)
62-62
: この翻訳は適切に行われていますが、文脈に応じてさらに自然な表現が可能かどうかを再検討してください。i18n/jaxaEarthApi_ja.ts (1)
62-62
: この翻訳は適切に行われていますが、文脈に応じてさらに自然な表現が可能かどうかを再検討してください。
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- i18n/jaxaEarthApi_en.ts (1 hunks)
- i18n/jaxaEarthApi_ja.ts (1 hunks)
- jaxaEarthApiDialog.py (3 hunks)
- jaxaEarthApiPlugin.py (1 hunks)
- jaxa_earth_api.pro (1 hunks)
Files skipped from review due to trivial changes (1)
- jaxa_earth_api.pro
Additional Context Used
Ruff (39)
jaxaEarthApiDialog.py (29)
22-22:
from PyQt5.QtCore import *
used; unable to detect undefined names
23-23:
from PyQt5.QtGui import *
used; unable to detect undefined names
24-24:
from PyQt5.QtWidgets import *
used; unable to detect undefined names
25-25:
from qgis.core import *
used; unable to detect undefined names
26-26:
from qgis.gui import *
used; unable to detect undefined names
84-84:
QDialog
may be undefined, or defined from star imports
85-85:
pyqtSignal
may be undefined, or defined from star imports
145-145:
QgsProject
may be undefined, or defined from star imports
147-147:
QgsProject
may be undefined, or defined from star imports
149-149:
QgsProject
may be undefined, or defined from star imports
201-201:
QDateTime
may be undefined, or defined from star imports
207-207:
QDateTime
may be undefined, or defined from star imports
214-214:
QDateTime
may be undefined, or defined from star imports
225-225:
QDateTime
may be undefined, or defined from star imports
249-249:
QDateTime
may be undefined, or defined from star imports
260-260:
QDateTime
may be undefined, or defined from star imports
276-276:
QMessageBox
may be undefined, or defined from star imports
306-306:
QMessageBox
may be undefined, or defined from star imports
318-318:
QMessageBox
may be undefined, or defined from star imports
322-322:
QMessageBox
may be undefined, or defined from star imports
322-322:
QMessageBox
may be undefined, or defined from star imports
326-326:
QMessageBox
may be undefined, or defined from star imports
327-327:
QMessageBox
may be undefined, or defined from star imports
334-334:
QMessageBox
may be undefined, or defined from star imports
365-365:
QgsDateTimeRange
may be undefined, or defined from star imports
366-366:
QDateTime
may be undefined, or defined from star imports
367-367:
QDateTime
may be undefined, or defined from star imports
373-373:
QgsProject
may be undefined, or defined from star imports
378-378:
QgsProject
may be undefined, or defined from star importsjaxaEarthApiPlugin.py (10)
18-18:
from PyQt5.QtCore import *
used; unable to detect undefined names
19-19:
from PyQt5.QtGui import *
used; unable to detect undefined names
20-20:
from PyQt5.QtWidgets import *
used; unable to detect undefined names
21-21:
from qgis.core import *
used; unable to detect undefined names
22-22:
from qgis.gui import *
used; unable to detect undefined names
42-42:
QSettings
may be undefined, or defined from star imports
49-49:
QTranslator
may be undefined, or defined from star imports
51-51:
QCoreApplication
may be undefined, or defined from star imports
65-65:
QIcon
may be undefined, or defined from star imports
66-66:
QAction
may be undefined, or defined from star imports
Biome (40)
i18n/jaxaEarthApi_en.ts (20)
1-1: Expected a type but instead found '?'.
1-1: expected
:
but instead foundversion
1-1: Expected a semicolon or an implicit semicolon after a statement, but found none
1-1: Expected an expression for the left hand side of the
>
operator.
2-2: Expected a type but instead found '!'.
2-2: expected
:
but instead foundTS
3-3: expected
>
but instead foundversion
2-3: Invalid assignment to
TS> <TS version
3-3: Expected a semicolon or an implicit semicolon after a statement, but found none
5-5: unterminated regex literal
7-7: expected
>
but instead foundfilename
3-7: Invalid assignment to
"en"> <context> <name>Dialog</name> <message> <location filename
7-7: Expected a semicolon or an implicit semicolon after a statement, but found none
7-7: Expected an expression but instead found '>'.
8-8: Expected a semicolon or an implicit semicolon after a statement, but found none
8-8: Expected a semicolon or an implicit semicolon after a statement, but found none
8-8: unterminated regex literal
9-9: Expected a semicolon or an implicit semicolon after a statement, but found none
9-9: Expected a type but instead found '/'.
9-9: unterminated regex literal
i18n/jaxaEarthApi_ja.ts (20)
1-1: Expected a type but instead found '?'.
1-1: expected
:
but instead foundversion
1-1: Expected a semicolon or an implicit semicolon after a statement, but found none
1-1: Expected an expression for the left hand side of the
>
operator.
2-2: Expected a type but instead found '!'.
2-2: expected
:
but instead foundTS
3-3: expected
>
but instead foundversion
2-3: Invalid assignment to
TS> <TS version
3-3: Expected a semicolon or an implicit semicolon after a statement, but found none
5-5: unterminated regex literal
7-7: expected
>
but instead foundfilename
3-7: Invalid assignment to
"ja"> <context> <name>Dialog</name> <message> <location filename
7-7: Expected a semicolon or an implicit semicolon after a statement, but found none
7-7: Expected an expression but instead found '>'.
8-8: Expected a semicolon or an implicit semicolon after a statement, but found none
8-8: Expected a semicolon or an implicit semicolon after a statement, but found none
8-8: unterminated regex literal
9-9: Expected a semicolon or an implicit semicolon after a statement, but found none
9-9: Expected a type but instead found '/'.
9-9: unterminated regex literal
Path-based Instructions (4)
i18n/jaxaEarthApi_en.ts (1)
Pattern
**/*.ts
: - is it possible to define better typing?
- can be available more immutable approach?
i18n/jaxaEarthApi_ja.ts (1)
Pattern
**/*.ts
: - is it possible to define better typing?
- can be available more immutable approach?
jaxaEarthApiPlugin.py (1)
Pattern
**/*.py
: - is it possible to use better type hinting?
- can be available more immutable approach?
jaxaEarthApiDialog.py (1)
Pattern
**/*.py
: - is it possible to use better type hinting?
- can be available more immutable approach?
Additional comments not posted (2)
i18n/jaxaEarthApi_en.ts (1)
9-9
: 翻訳が「未完成」とマークされています。これらの翻訳を完了させるか、または翻訳が不要であればこのマークを削除してください。Also applies to: 14-14, 19-19, 24-24, 29-29, 34-34, 42-42, 47-47, 52-52, 57-57, 67-67
i18n/jaxaEarthApi_ja.ts (1)
9-9
: 翻訳が「未完成」とマークされています。これらの翻訳を完了させるか、または翻訳が不要であればこのマークを削除してください。Also applies to: 14-14, 19-19, 24-24, 29-29, 34-34, 42-42, 47-47, 52-52, 57-57, 67-67
# initialize locale | ||
locale = QSettings().value('locale/userLocale')[0:2] | ||
locale_path = os.path.join( | ||
self.plugin_dir, | ||
'i18n', | ||
'jaxaEarthApi_{}.qm'.format(locale)) | ||
|
||
if os.path.exists(locale_path): | ||
self.translator = QTranslator() | ||
self.translator.load(locale_path) | ||
QCoreApplication.installTranslator(self.translator) |
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.
ローカライゼーションの初期化に関する変更は適切に実装されています。ただし、QSettings
, QTranslator
, QCoreApplication
が未定義の可能性があるため、これらのクラスを明示的にインポートすることをお勧めします。
+ from PyQt5.QtCore import QSettings, QTranslator, QCoreApplication
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.
# initialize locale | |
locale = QSettings().value('locale/userLocale')[0:2] | |
locale_path = os.path.join( | |
self.plugin_dir, | |
'i18n', | |
'jaxaEarthApi_{}.qm'.format(locale)) | |
if os.path.exists(locale_path): | |
self.translator = QTranslator() | |
self.translator.load(locale_path) | |
QCoreApplication.installTranslator(self.translator) | |
from PyQt5.QtCore import QSettings, QTranslator, QCoreApplication | |
# initialize locale | |
locale = QSettings().value('locale/userLocale')[0:2] | |
locale_path = os.path.join( | |
self.plugin_dir, | |
'i18n', | |
'jaxaEarthApi_{}.qm'.format(locale)) | |
if os.path.exists(locale_path): | |
self.translator = QTranslator() | |
self.translator.load(locale_path) | |
QCoreApplication.installTranslator(self.translator) |
jaxaEarthApiDialog.py
Outdated
@@ -274,7 +274,7 @@ def load_dataset(self): | |||
> 365 * 24 * 60 * 60 | |||
): | |||
QMessageBox.information( | |||
self, "Error", "1年を超える期間を指定することは出来ません。" | |||
self, "Error", self.tr("1年を超える期間を指定することは出来ません。", None) |
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.
データセットのロードとエラーハンドリングに関するロジックは適切に実装されていますが、QMessageBox
が未定義の可能性があるため、このクラスを明示的にインポートすることをお勧めします。
+ from PyQt5.QtWidgets import QMessageBox
Also applies to: 317-329, 332-340
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.
self, "Error", self.tr("1年を超える期間を指定することは出来ません。", None) | |
from PyQt5.QtWidgets import QMessageBox | |
self, "Error", self.tr("1年を超える期間を指定することは出来ません。", None) |
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.
CodeRabbitがコメントをしてくれていますが、ワイルドカードによるimportは規約上NGとしたので、うさぎさんのすすめのとおり、明示的にimportしていただきたいです!
https://www.notion.so/mierune/QGIS-780d34ed65964e0db437424949a55a3b
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.
@Kanahiro, ありがとうございます!ワイルドカードによるインポートを避け、QMessageBox
を明示的にインポートすることは、コードの明確性と保守性を向上させる良い実践です。ご指摘の通りに修正を進めていただければと思います。もし他にもレビューが必要な点があれば、お知らせください。
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.
Thanks ! 助かりました!
動作確認がOK
IMO
Source codeのUIやメッセージの文書が基本的に英語で書いてありますので、統一のため
`
i18n/jaxaEarthApi_en.ts
Outdated
</message> | ||
<message> | ||
<location filename="../jaxaEarthApiDialog.py" line="276"/> | ||
<source>1年を超える期間を指定することは出来ません。</source> |
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.
IMO : put source in english
i18n/jaxaEarthApi_ja.ts
Outdated
</message> | ||
<message> | ||
<location filename="../jaxaEarthApiDialog.py" line="276"/> | ||
<source>1年を超える期間を指定することは出来ません。</source> |
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.
IMO : put source in english
jaxaEarthApiDialog.py
Outdated
@@ -274,7 +274,7 @@ def load_dataset(self): | |||
> 365 * 24 * 60 * 60 | |||
): | |||
QMessageBox.information( | |||
self, "Error", "1年を超える期間を指定することは出来ません。" | |||
self, "Error", self.tr("1年を超える期間を指定することは出来ません。", None) |
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.
IMO : put source in english
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: 0
Outside diff range and nitpick comments (1)
jaxaEarthApiPlugin.py (1)
Line range hint
18-22
: ワイルドカードインポートは使用しないでください。これにより、未定義の名前が発生する可能性があります。- from PyQt5.QtGui import * - from PyQt5.QtWidgets import * - from qgis.core import * - from qgis.gui import * + from PyQt5.QtGui import QIcon + from PyQt5.QtWidgets import QAction + from qgis.core import Qgis + from qgis.gui import QgisInterface
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- i18n/jaxaEarthApi_en.ts (1 hunks)
- i18n/jaxaEarthApi_ja.ts (1 hunks)
- jaxaEarthApiDialog.py (1 hunks)
- jaxaEarthApiPlugin.py (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- jaxaEarthApiDialog.py
Additional Context Used
Ruff (6)
jaxaEarthApiPlugin.py (6)
19-19:
from PyQt5.QtGui import *
used; unable to detect undefined names
20-20:
from PyQt5.QtWidgets import *
used; unable to detect undefined names
21-21:
from qgis.core import *
used; unable to detect undefined names
22-22:
from qgis.gui import *
used; unable to detect undefined names
65-65:
QIcon
may be undefined, or defined from star imports
66-66:
QAction
may be undefined, or defined from star imports
Biome (40)
i18n/jaxaEarthApi_en.ts (20)
1-1: Expected a type but instead found '?'.
1-1: expected
:
but instead foundversion
1-1: Expected a semicolon or an implicit semicolon after a statement, but found none
1-1: Expected an expression for the left hand side of the
>
operator.
2-2: Expected a type but instead found '!'.
2-2: expected
:
but instead foundTS
3-3: expected
>
but instead foundversion
2-3: Invalid assignment to
TS> <TS version
3-3: Expected a semicolon or an implicit semicolon after a statement, but found none
5-5: unterminated regex literal
7-7: expected
>
but instead foundfilename
3-7: Invalid assignment to
"en"> <context> <name>Dialog</name> <message> <location filename
7-7: Expected a semicolon or an implicit semicolon after a statement, but found none
7-7: Expected an expression but instead found '>'.
8-8: Expected a semicolon or an implicit semicolon after a statement, but found none
8-8: Expected a semicolon or an implicit semicolon after a statement, but found none
8-8: unterminated regex literal
9-9: Expected a semicolon or an implicit semicolon after a statement, but found none
9-9: Expected a type but instead found '/'.
9-9: unterminated regex literal
i18n/jaxaEarthApi_ja.ts (20)
1-1: Expected a type but instead found '?'.
1-1: expected
:
but instead foundversion
1-1: Expected a semicolon or an implicit semicolon after a statement, but found none
1-1: Expected an expression for the left hand side of the
>
operator.
2-2: Expected a type but instead found '!'.
2-2: expected
:
but instead foundTS
3-3: expected
>
but instead foundversion
2-3: Invalid assignment to
TS> <TS version
3-3: Expected a semicolon or an implicit semicolon after a statement, but found none
5-5: unterminated regex literal
7-7: expected
>
but instead foundfilename
3-7: Invalid assignment to
"ja"> <context> <name>Dialog</name> <message> <location filename
7-7: Expected a semicolon or an implicit semicolon after a statement, but found none
7-7: Expected an expression but instead found '>'.
8-8: Expected a semicolon or an implicit semicolon after a statement, but found none
8-8: Expected a semicolon or an implicit semicolon after a statement, but found none
8-8: unterminated regex literal
9-9: Expected a semicolon or an implicit semicolon after a statement, but found none
9-9: Expected a type but instead found '/'.
9-9: unterminated regex literal
Path-based Instructions (3)
i18n/jaxaEarthApi_en.ts (1)
Pattern
**/*.ts
: - is it possible to define better typing?
- can be available more immutable approach?
i18n/jaxaEarthApi_ja.ts (1)
Pattern
**/*.ts
: - is it possible to define better typing?
- can be available more immutable approach?
jaxaEarthApiPlugin.py (1)
Pattern
**/*.py
: - is it possible to use better type hinting?
- can be available more immutable approach?
Additional comments not posted (1)
jaxaEarthApiPlugin.py (1)
41-51
: ロケールの初期化と翻訳のロードが適切に実装されています。以前のレビューコメントに基づいて、必要なインポートが追加されています。
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 🎷
Issue
close #15
変更内容:Description
指定期間が1年以上の時に表示されるメッセージを多言語化しました。
テスト手順:Test
その他:Notes
Summary by CodeRabbit
新機能
バグ修正
改善