-
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/i18n #167
Conversation
WalkthroughThe changes involve significant updates to the wallet application, primarily focusing on internationalization (i18n) enhancements. Key modifications include the integration of translation functions across various components, the addition of new localization strings for multiple languages, and the introduction of a language selection feature. Dependency versions for localization libraries have been updated, and session management has been improved to support dynamic language switching. Additionally, several components have been modified to utilize these internationalization features, enhancing the overall user experience. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App
participant Session
participant LanguageService
User->>App: Select Language
App->>Session: switchLanguage(lang)
Session->>LanguageService: Update language setting
LanguageService-->>Session: Language updated
Session-->>App: Notify language change
App->>User: Display updated language
Tip OpenAI O1 model for chat
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 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 (
|
Deploy preview for hibit-id ready! ✅ Preview Built with commit 52cb90b. |
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)
apps/wallet/src/utils/lang.ts (1)
15-25
: Consider simplifying thegetSystemLang
function.The
getSystemLang
function correctly determines the user's language based on thenavigator.language
property, but it could be simplified:
- The check for Traditional Chinese could be more concise by directly comparing
navigator.language
with 'zh-TW' and 'zh-HK':if (['zh-TW', 'zh-HK'].includes(language)) { return 'cnt'; }
- If the user's specific region is not supported, it might be better to fall back to the language code ('zh', 'ja', etc.) if available, rather than always using 'en' (English):
const [languageCode] = language.split('-'); if (Object.keys(languages).includes(languageCode)) { return languageCode as Language; }Here's a suggested refactoring of the
getSystemLang
function:export const getSystemLang = (): Language => { const language = window.navigator.language; if (['zh-TW', 'zh-HK'].includes(language)) { return 'cnt'; } const [languageCode] = language.split('-'); if (Object.keys(languages).includes(languageCode)) { return languageCode as Language; } return 'en'; };
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (2)
apps/wallet/src/assets/blue-check.svg
is excluded by!**/*.svg
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
Files selected for processing (31)
- apps/wallet/package.json (1 hunks)
- apps/wallet/src/App.tsx (2 hunks)
- apps/wallet/src/apis/index.ts (1 hunks)
- apps/wallet/src/components/CopyButton.tsx (1 hunks)
- apps/wallet/src/components/LogoSection.tsx (2 hunks)
- apps/wallet/src/components/ReceiveButton.tsx (2 hunks)
- apps/wallet/src/components/SendButton.tsx (2 hunks)
- apps/wallet/src/i18n/locales/cnt.json (1 hunks)
- apps/wallet/src/i18n/locales/en.json (2 hunks)
- apps/wallet/src/i18n/locales/ja.json (1 hunks)
- apps/wallet/src/i18n/locales/ru.json (1 hunks)
- apps/wallet/src/main.tsx (1 hunks)
- apps/wallet/src/pages/account-manage/index.tsx (1 hunks)
- apps/wallet/src/pages/login/index.tsx (2 hunks)
- apps/wallet/src/pages/main/index.tsx (3 hunks)
- apps/wallet/src/pages/password/create.tsx (4 hunks)
- apps/wallet/src/pages/password/reset.tsx (6 hunks)
- apps/wallet/src/pages/password/verify.tsx (5 hunks)
- apps/wallet/src/pages/receive-token/index.tsx (2 hunks)
- apps/wallet/src/pages/select-lang/index.tsx (1 hunks)
- apps/wallet/src/pages/select-network/index.tsx (1 hunks)
- apps/wallet/src/pages/send-token/confirm-page.tsx (7 hunks)
- apps/wallet/src/pages/send-token/index.tsx (5 hunks)
- apps/wallet/src/pages/settings/index.tsx (2 hunks)
- apps/wallet/src/stores/session.ts (5 hunks)
- apps/wallet/src/utils/lang.ts (1 hunks)
- apps/wallet/src/utils/runtime.ts (2 hunks)
- packages/sdk/src/lib/dom/index.ts (3 hunks)
- packages/sdk/src/lib/index.ts (1 hunks)
- packages/sdk/src/lib/types.ts (1 hunks)
- packages/sdk/src/lib/wallet.ts (1 hunks)
Files skipped from review due to trivial changes (2)
- apps/wallet/src/main.tsx
- apps/wallet/src/pages/account-manage/index.tsx
Additional comments not posted (139)
apps/wallet/src/components/ReceiveButton.tsx (3)
5-5
: LGTM!The
useTranslation
hook is correctly imported from thereact-i18next
library. This import is necessary for using the translation functionality in the component.
9-9
: LGTM!The
t
function is correctly destructured from theuseTranslation
hook. This function will be used to translate the button label.
21-21
: LGTM!The button label is correctly translated using the
t
function with the translation key'common_receive'
. This allows the button label to be dynamically translated based on the user's selected language.apps/wallet/src/components/LogoSection.tsx (1)
13-18
: LGTM!The changes correctly integrate internationalization support using the
react-i18next
library. The use of theTrans
component with ani18nKey
allows for dynamic translation based on the user's language preferences. Wrapping theWeb3.0
term in a span ensures that it retains its visual emphasis while being part of the translatable content. These changes enhance the application's accessibility and usability for a broader audience by supporting multiple languages.apps/wallet/src/components/SendButton.tsx (3)
6-6
: LGTM!The
useTranslation
hook is correctly imported from thereact-i18next
library. This is a standard approach to integrate internationalization in React components.
14-14
: LGTM!The
t
function is correctly destructured from theuseTranslation
hook. This function is used to translate strings based on the user's selected language.
26-26
: Verify the translation key in the localization files.The hardcoded text "Send" is correctly replaced with a translatable string using the
t
function.Ensure that the translation key
'common_send'
is defined in the localization files for each supported language. You can use the following script to search for the key in the localization files:Verification successful
Translation key 'common_send' is correctly defined in multiple language files.
The 'common_send' translation key has been verified and is present in the following localization files:
- English (en.json)
- Russian (ru.json)
- Japanese (ja.json)
- Chinese (Traditional) (cnt.json)
The translations are appropriate for each language, and the change has been implemented correctly.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the translation key `'common_send'` is defined in the localization files. # Test: Search for the key in JSON files. Expect: At least one match. rg --type json -e $'"common_send"'Length of output: 285
apps/wallet/src/components/CopyButton.tsx (3)
6-6
: LGTM!The import statement for the
useTranslation
hook is correctly added to facilitate internationalization support in the component.
13-14
: LGTM!The
t
function is correctly destructured from theuseTranslation
hook to retrieve localized strings for the component.
22-22
: LGTM!The hardcoded strings for the success and error messages in the toaster notifications are correctly replaced with calls to the
t
function to retrieve localized strings. This enhances the user experience by displaying messages in the user's preferred language.Please ensure that the translation keys
'common_copySuccess'
and'common_copyFailed'
are correctly defined in the translation files for all supported languages.Run the following script to verify the presence of these keys:
Also applies to: 25-25
Verification successful
Translation keys are correctly defined in all supported language files
The verification process confirms that the translation keys "common_copySuccess" and "common_copyFailed" are properly defined in all the localization files (Chinese Traditional, English, Japanese, and Russian) located in the
apps/wallet/src/i18n/locales/
directory. This ensures that the copy success and failure messages will be correctly localized for all supported languages.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the presence of translation keys in the localization files. # Test: Search for the translation keys in the localization files. Expect: At least one match for each key. fd -e json | xargs -I {} sh -c "cat {} | jq 'has(\"common_copySuccess\") and has(\"common_copyFailed\")'" | uniqLength of output: 251
Script:
#!/bin/bash # Description: Further investigate translation files and their contents # List all JSON files echo "All JSON files in the repository:" fd -e json # Display content of JSON files containing either of the required keys echo -e "\nContent of JSON files with required keys:" fd -e json | xargs -I {} sh -c "if jq 'has(\"common_copySuccess\") or has(\"common_copyFailed\")' {} > /dev/null 2>&1; then echo '{}:'; jq '.' {}; fi" # Check for malformed JSON files echo -e "\nMalformed JSON files:" fd -e json | xargs -I {} sh -c "if ! jq '.' {} > /dev/null 2>&1; then echo '{}'; fi"Length of output: 26634
packages/sdk/src/lib/index.ts (1)
8-8
: LGTM!The addition of the
Language
type to the list of exported types is a straightforward change that enhances the module's interface. This change makes theLanguage
type available for import, which can be utilized in other parts of the application to define or enforce language-related functionalities. The change does not alter existing logic or control flow but expands the module's capabilities by providing access to a new type.apps/wallet/src/pages/receive-token/index.tsx (3)
7-7
: LGTM!The
useTranslation
hook is correctly imported from thereact-i18next
library. This import is necessary for using the translation functionality in the component.
11-11
: LGTM!The
t
function is correctly destructured from theuseTranslation
hook. This function will be used to translate strings in the component.
25-25
: LGTM!The
title
prop of thePageHeader
component and the description paragraph are correctly updated to use translated strings. Thet
function is used with the appropriate translation keys (page_receive_title
andpage_receive_desc
). ThechainName
variable is also passed as a dynamic value to thepage_receive_desc
translation string. These changes are consistent with the AI-generated summary and enhance the internationalization support of the component.Also applies to: 27-27
apps/wallet/src/pages/select-lang/index.tsx (4)
1-9
: LGTM!The imports are correctly specified and the required dependencies are being imported.
10-12
: LGTM!The functional component is correctly defined and the required hooks are being used.
13-38
: LGTM!The language selection page is being rendered correctly and the required functionality is being implemented.
40-40
: LGTM!The component is being exported correctly.
apps/wallet/src/utils/runtime.ts (4)
4-4
: LGTM!The import statement for the
Language
type is correct and necessary for using it in this file.
12-12
: LGTM!The variable declaration for
runtimeLang
is correct and will be used to store the language setting retrieved from the URL query string.
35-35
: LGTM!The code correctly retrieves the
lang
parameter from the URL query string, casts it to theLanguage
type, and assigns it toruntimeLang
. SettingruntimeLang
toundefined
when thelang
parameter is not present is a good fallback mechanism.
42-47
: LGTM!Exporting
RUNTIME_LANG
makes the language setting available to other parts of the application. The debug statements provide visibility into the runtime environment's configuration, including the language setting.apps/wallet/src/pages/login/index.tsx (3)
13-13
: LGTM!The
useTranslation
hook is correctly imported from thereact-i18next
library. This is a standard way to integrate internationalization in React components.
19-19
: LGTM!The
t
function is correctly destructured from theuseTranslation
hook. This is the recommended way to translate strings in the component.
30-30
: LGTM!The static text is correctly replaced with a translatable string using the
t
function. The translation key'page_login_loginBy'
follows a consistent naming convention, which is important for maintainability.apps/wallet/src/pages/select-network/index.tsx (1)
29-29
: LGTM!The change to use the translation function for the page title is a good practice for internationalization. It allows the title to be rendered in different languages based on the user's locale.
apps/wallet/package.json (1)
35-35
: Dependency updates look good!The minor version updates to
i18next
andreact-i18next
should bring in bug fixes, performance improvements, and potentially new features while maintaining backward compatibility. These updates align with the goal of enhancing internationalization in the wallet application.Also applies to: 40-40
apps/wallet/src/apis/index.ts (1)
8-16
: LGTM! The changes enhance query behavior and error handling.The modifications to the
queryClient
initialization improve control over query execution and error handling:
- Setting
retry
to 1 allows a single retry for failed queries, which can help recover from temporary network issues or server errors.- Setting
retryDelay
to 3000 ms introduces a delay before retrying, preventing overwhelming the server with immediate retries.- Setting
refetchOnWindowFocus
to false prevents automatic refetching of queries when the window regains focus, optimizing performance and reducing unnecessary network requests.These changes align with the goal of improving the user experience by managing query behavior under certain conditions.
apps/wallet/src/pages/main/index.tsx (3)
16-16
: LGTM!The import statement for the
useTranslation
hook from thereact-i18next
library is correct and necessary for integrating internationalization support in the component.
19-19
: LGTM!The destructuring assignment for the
t
function from theuseTranslation
hook is correct and necessary for using the translation functionality in the component.
58-58
: LGTM!The usage of the
t
function to replace hardcoded strings with translatable strings is correct and consistent with the internationalization (i18n) support. This change improves the accessibility and localization of the application, enabling it to support multiple languages more effectively.Also applies to: 68-68
apps/wallet/src/pages/settings/index.tsx (2)
10-10
: LGTM!The import statement is correct and necessary for the language selection feature.
70-82
: Excellent work on adding the language selection feature!The code changes are well-structured, follow the existing coding style, and implement the language selection functionality correctly. The use of the
languages
object andhibitIdSession.config.lang
is appropriate for displaying the current language. The navigation to the/lang-select
page is implemented correctly using thenavigate
function. The translation functiont
is used appropriately for the section title.Great job!
packages/sdk/src/lib/types.ts (2)
6-6
: LGTM!The new
Language
type definition is a good addition for supporting internationalization. The chosen language codes follow the ISO 639-1 standard, which is a best practice.
12-12
: LGTM!The
lang
property is a good addition to theHibitIdWalletOptions
interface for supporting internationalization. Marking it as optional is the correct approach as users may choose not to specify a language preference.apps/wallet/src/i18n/locales/cnt.json (13)
54-55
: LGTM!The added localization strings for "logout" and "unlock" actions are appropriate and consistent with the existing format.
56-57
: LGTM!The added localization strings for "copy success" and "copy failed" messages are appropriate and consistent with the existing format.
58-60
: LGTM!The added localization strings for "send", "receive", and "close" actions are appropriate and consistent with the existing format.
62-66
: LGTM!The added localization strings for the logo section description, net worth, and tokens on the home page are appropriate and consistent with the existing format.
68-68
: LGTM!The added localization string for the network selection page title is appropriate and consistent with the existing format.
70-83
: LGTM!The added localization strings for the send page, including field labels, placeholders, error messages, and transaction status messages, are appropriate and consistent with the existing format. They cover various scenarios and provide clear guidance to the user.
85-86
: LGTM!The added localization strings for the receive page title and description are appropriate and consistent with the existing format.
89-89
: LGTM!The added localization string for the current login status message is appropriate and consistent with the existing format.
90-96
: LGTM!The added localization strings for password-related actions, such as setting a password, unlocking the wallet, changing the wallet password, and confirming the password, are appropriate and consistent with the existing format. They cover various password-related scenarios.
97-102
: LGTM!The added localization strings for password-related error messages, such as minimum character requirement, password required, new password required, password mismatch, and incorrect password, are appropriate and consistent with the existing format. They cover various password validation scenarios and provide clear error messages to the user.
110-110
: LGTM!The added localization string for the language setting in the settings page is appropriate and consistent with the existing format.
112-112
: LGTM!The added localization string for the linked accounts status message is appropriate and consistent with the existing format.
113-113
: LGTM!The added localization string for the language selection page title is appropriate and consistent with the existing format.
apps/wallet/src/i18n/locales/ja.json (23)
54-54
: LGTM!The Japanese translation "ログアウト" accurately conveys the meaning of "logout".
55-55
: LGTM!The Japanese translation "ロック解除" accurately conveys the meaning of "unlock".
56-56
: LGTM!The Japanese translation "コピー成功" accurately conveys the meaning of "copy success".
57-57
: LGTM!The Japanese translation "コピー失敗" accurately conveys the meaning of "copy failed".
58-58
: LGTM!The Japanese translation "送信" accurately conveys the meaning of "send".
59-59
: LGTM!The Japanese translation "受信" accurately conveys the meaning of "receive".
60-60
: LGTM!The Japanese translation "閉じる" accurately conveys the meaning of "close".
62-62
: LGTM!The Japanese translation "Web3.0の富を解き放つ" accurately conveys the meaning of "Unlock the wealth of Web3.0".
63-63
: LGTM!The Japanese translation "次の方法でログイン" accurately conveys the meaning of "Login by".
65-65
: LGTM!The Japanese translation "純資産" accurately conveys the meaning of "Net Worth".
66-66
: LGTM!The Japanese translation "トークン" accurately conveys the meaning of "Tokens".
68-68
: LGTM!The Japanese translation "ネットワークを選択" accurately conveys the meaning of "Select Network".
70-70
: LGTM!The Japanese translation "送信" accurately conveys the meaning of "Send".
71-71
: LGTM!The Japanese translation "送信先" accurately conveys the meaning of "Send To".
72-72
: LGTM!The Japanese translation "受取人のアドレス" accurately conveys the meaning of "Recipient's address".
73-73
: LGTM!The Japanese translation "数量" accurately conveys the meaning of "Amount".
74-74
: LGTM!The Japanese translation "ネットワーク手数料推定" accurately conveys the meaning of "Estimated network fee".
75-75
: LGTM!The Japanese translation "アドレスが必要です" accurately conveys the meaning of "Address is required".
76-76
: LGTM!The Japanese translation "無効なアドレス" accurately conveys the meaning of "Invalid address".
77-77
: LGTM!The Japanese translation "数量が必要です" accurately conveys the meaning of "Amount is required".
78-78
: LGTM!The Japanese translation "数量は0より大きくなければなりません" accurately conveys the meaning of "Amount must be greater than 0".
79-79
: LGTM!The Japanese translation "残高不足" accurately conveys the meaning of "Insufficient balance".
80-80
: LGTM!The Japanese translation "ウォレットのガス不足(最低でも{{atLeast}}必要)"
apps/wallet/src/pages/password/create.tsx (4)
23-30
: LGTM!The changes to the
formSchema
object correctly utilize thet
function from theuseTranslation
hook to provide translated error messages for form validation. The translation keys used are descriptive and follow a consistent naming convention, enhancing the user experience by displaying error messages in the user's preferred language.
78-80
: LGTM!The change to the label text for the password input field correctly utilizes the
t
function from theuseTranslation
hook to provide a translated label. The translation key used is descriptive and follows a consistent naming convention, enhancing the user experience by displaying the label in the user's preferred language.
98-100
: LGTM!The change to the label text for the confirm password input field correctly utilizes the
t
function from theuseTranslation
hook to provide a translated label. The translation key used is descriptive and follows a consistent naming convention, enhancing the user experience by displaying the label in the user's preferred language.
123-123
: LGTM!The change to the submit button text correctly utilizes the
t
function from theuseTranslation
hook to provide a translated label. The translation key used is descriptive and follows a consistent naming convention, enhancing the user experience by displaying the button text in the user's preferred language.apps/wallet/src/pages/password/verify.tsx (6)
22-22
: LGTM!The
useTranslation
hook is correctly imported from thereact-i18next
library to enable internationalization in the component.
26-26
: LGTM!The translation function
t
is correctly destructured from theuseTranslation
hook to enable string translations in the component.
31-35
: LGTM!The
password
field schema in theformSchema
object is correctly updated to use thet
function for error messages. This enables localized error messages for the password field.
66-66
: LGTM!The error message for the
INVALID_PASSWORD
error code is correctly updated to use thet
function with the translation keypage_password_errorPwdIncorrect
. This enables a localized error message for the invalid password error.
79-85
: LGTM!The
PageHeader
component'stitle
prop and thespan
element's text are correctly updated to use thet
function with the respective translation keys. This enables localized text for the page header title and the current login provider message. TheauthName
variable is also passed as a parameter to display the current login provider name.
95-95
: LGTM!The logout button text, password input label text, and submit button text are correctly updated to use the
t
function with the respective translation keys. This enables localized text for these UI elements.Also applies to: 103-105, 129-129
apps/wallet/src/i18n/locales/en.json (5)
55-61
: LGTM!The added entries for common actions like "Logout", "Unlock", "Send", "Receive", etc. are appropriate and consistent with the existing localization keys.
64-65
: LGTM!The modified description for the logo section personalizes the experience by mentioning "Web3.0". The change is appropriate.
66-106
: Excellent work on enhancing the user experience!The added entries for various pages significantly improve the usability and security features of the wallet application:
- The "Send" section includes detailed error messages for various scenarios, which will help users understand issues during transactions.
- The "Receive" section description personalizes the experience by including the chain name.
- The password management section includes prompts and error messages, guiding users through password creation, confirmation, and error handling. This covers critical aspects like password length requirements and matching.
These changes make the wallet more user-friendly and informative. Great job!
115-115
: LGTM!The added entry for language selection in the settings page is a great addition. It allows users to choose their preferred language, enhancing accessibility.
118-120
: LGTM!The added entries for the account linking and language selection pages are appropriate and consistent with the page titles.
apps/wallet/src/i18n/locales/ru.json (13)
54-54
: LGTM!The localization string for logging out is appropriate and consistent with the existing strings.
55-55
: LGTM!The localization string for unlocking is appropriate and consistent with the existing strings.
56-57
: LGTM!The localization strings for copy success and failure are appropriate and consistent with the existing strings.
58-60
: LGTM!The localization strings for sending, receiving, and closing are appropriate and consistent with the existing strings.
62-62
: LGTM!The localization string for the logo section description is appropriate and consistent with the existing strings.
63-66
: LGTM!The localization strings for login, net worth, and tokens are appropriate and consistent with the existing strings.
68-68
: LGTM!The localization string for selecting a network is appropriate and consistent with the existing strings.
70-83
: LGTM!The localization strings for the send page, including field labels, placeholders, and error messages, are appropriate and consistent with the existing strings.
85-86
: LGTM!The localization strings for the receive page title and description are appropriate and consistent with the existing strings.
89-96
: LGTM!The localization strings for the password page, including field labels and actions, are appropriate and consistent with the existing strings.
97-102
: LGTM!The localization strings for password error messages are appropriate and consistent with the existing strings.
110-110
: LGTM!The localization string for language in the settings page is appropriate and consistent with the existing strings.
112-113
: LGTM!The localization strings for the account page and language page titles are appropriate and consistent with the existing strings.
apps/wallet/src/pages/password/reset.tsx (8)
21-30
: LGTM!The
formSchema
object is correctly updated to use thet
function from theuseTranslation
hook for error messages. This enables internationalization of the error messages.
58-58
: LGTM!The success message for password change confirmation is correctly updated to use the
t
function from theuseTranslation
hook. This enables internationalization of the success message.
62-62
: LGTM!The error message for incorrect password is correctly updated to use the
t
function from theuseTranslation
hook. This enables internationalization of the error message.
79-79
: LGTM!The
title
prop of thePageHeader
component is correctly updated to use thet
function from theuseTranslation
hook. This enables internationalization of the page header title.
84-86
: LGTM!The label text for the password input field is correctly updated to use the
t
function from theuseTranslation
hook. This enables internationalization of the label text.
104-106
: LGTM!The label text for the new password input field is correctly updated to use the
t
function from theuseTranslation
hook. This enables internationalization of the label text.
123-125
: LGTM!The label text for the confirm password input field is correctly updated to use the
t
function from theuseTranslation
hook. This enables internationalization of the label text.
148-148
: LGTM!The text for the confirm button is correctly updated to use the
t
function from theuseTranslation
hook. This enables internationalization of the button text.apps/wallet/src/App.tsx (2)
30-30
: LGTM!The lazy loading of the
SelectLangPage
component is implemented correctly and follows the existing code conventions.
117-117
: LGTM!The new route for the
SelectLangPage
component is added correctly within theRoutes
component and is conditionally rendered for logged-in users, which aligns with the expected behavior for a language selection feature.apps/wallet/src/pages/send-token/index.tsx (10)
18-18
: LGTM!The import statement for the
useTranslation
hook from thereact-i18next
library is correct and aligns with the PR objective of adding internationalization support.
25-25
: LGTM!The destructuring assignment for the
t
function from theuseTranslation
hook is correct and will enable using the translation function in the component.
33-33
: LGTM!The
required
validation message for thetoAddress
field is correctly updated to use thet
function for translation, aligning with the PR objective of internationalizing validation messages.
34-34
: LGTM!The custom validation message for the
toAddress
field is correctly updated to use thet
function for translation, aligning with the PR objective of internationalizing validation messages.
39-39
: LGTM!The
required
validation message for theamount
field is correctly updated to use thet
function for translation, aligning with the PR objective of internationalizing validation messages.
41-41
: LGTM!The custom validation message for the
amount
field is correctly updated to use thet
function for translation when the amount is too small, aligning with the PR objective of internationalizing validation messages.
47-47
: LGTM!The custom validation message for the
amount
field is correctly updated to use thet
function for translation when the balance is insufficient, aligning with the PR objective of internationalizing validation messages.
94-94
: LGTM!The
title
prop of thePageHeader
component and the label text for the "Send To" field are correctly updated to use thet
function for translation, aligning with the PR objective of internationalizing UI text.Also applies to: 99-101
104-104
: LGTM!The placeholder text for the "Send To" field, the label text for the "Amount" field, and the "Max" button text are correctly updated to use the
t
function for translation, aligning with the PR objective of internationalizing UI text.Also applies to: 118-120, 129-129
185-185
: LGTM!The "Send" button text is correctly updated to use the
t
function for translation, aligning with the PR objective of internationalizing UI text.packages/sdk/src/lib/dom/index.ts (2)
3-3
: LGTM!The import statement for the
Language
type is correct. It's likely used in the code changes below.
159-159
: Looks good!The code changes to the
HibitIdIframe
constructor and theiframe.src
URL construction are implemented correctly. The changes enable passing a language parameter to load language-specific content in the iframe.A few additional observations:
- The default value of an empty string for the
lang
parameter ensures backward compatibility.- The
Language
type is imported correctly at the top of the file.Great job on enhancing the internationalization capabilities of the iframe!
Also applies to: 170-170
apps/wallet/src/pages/send-token/confirm-page.tsx (12)
18-18
: LGTM!The import statement for the
useTranslation
hook from thereact-i18next
library is correct and necessary for using the translation functionality in the component.
24-24
: LGTM!The destructuring of the
useTranslation
hook to get thet
function is correct and necessary for using thet
function to translate strings in the component.
67-69
: LGTM!The usage of the translation key and the interpolation of the
atLeast
variable for the insufficient gas error message is correct and improves the localization of the error message.
115-115
: LGTM!The usage of the translation key for the text "Awaiting confirmation" is correct and improves the localization of the text.
127-127
: LGTM!The usage of the translation key for the text "Transfer finished" is correct and improves the localization of the text.
130-130
: LGTM!The usage of the translation key for the text "View in explorer" is correct and improves the localization of the text.
138-138
: LGTM!The usage of the translation key for the text "Close" is correct and improves the localization of the text.
146-146
: LGTM!The usage of the translation key for the page header title is correct and improves the localization of the title.
151-153
: LGTM!The usage of the translation key for the label text "Send to" is correct and improves the localization of the label.
164-166
: LGTM!The usage of the translation key for the label text "Amount" is correct and improves the localization of the label.
177-179
: LGTM!The usage of the translation key for the label text "Network fee estimation" is correct and improves the localization of the label.
207-207
: LGTM!The usage of the translation keys for the button text "Cancel" and "Confirm" is correct and improves the localization of the buttons.
Also applies to: 214-214
apps/wallet/src/stores/session.ts (5)
5-5
: LGTM!The import is correctly added and is likely used for handling language settings based on the runtime environment.
16-16
: LGTM!The imports are correctly added.
getSystemLang
is likely used to get the system language andLanguage
is likely an enum or type representing supported languages.
25-25
: LGTM!The
lang
property is correctly added to theSessionConfig
interface to store the language setting. This change aligns with the list of alterations provided.
Line range hint
35-57
: LGTM!The changes correctly initialize the
lang
property based on the system language and prioritize theRUNTIME_LANG
over the stored configuration. Callingi18n.changeLanguage
ensures that the language is updated in the internationalization framework when the configuration is loaded.
128-133
: LGTM!The
switchLanguage
method is correctly implemented to allow dynamically switching the language. It updates the language in the internationalization framework, the session configuration, and local storage. This change aligns with the list of alterations provided.packages/sdk/src/lib/wallet.ts (1)
284-289
: LGTM!The change to include the
lang
parameter in theHibitIdIframe
constructor aligns with the PR objective of implementing internationalization (i18n) for the wallet application. The modification is straightforward and does not introduce any correctness, security, or performance issues.
Summary by CodeRabbit
Release Notes
New Features
Enhancements
Bug Fixes
These updates aim to enhance user experience by providing a more accessible and customizable interface.