ApiBR / vagas-aggregator-ui

šŸ“šŸ¢ Vagas Aggregator UI
https://apibr.com/ui/vagas
MIT License
7 stars 1 forks source link

Add i18n support with gitauto model #234

Closed gitauto-ai[bot] closed 2 weeks ago

gitauto-ai[bot] commented 2 months ago

Original issue: #67

What is the feature

The feature is to add internationalization (i18n) support to the application.

Why we need the feature

Adding i18n support is essential for making the application accessible to a broader audience by allowing it to be easily translated into multiple languages. This will enhance user experience for non-English speakers and potentially increase the user base.

How to implement and why

  1. Choose an i18n Library:

    • Select a widely-used i18n library such as react-i18next for React applications. This library is well-documented and integrates seamlessly with React.
  2. Install the Library:

    • Add the i18n library to the project dependencies.
    • Example: npm install react-i18next i18next.
  3. Initialize i18n Configuration:

    • Create an i18n.js file in the src directory to configure the i18n settings.
    • Initialize the i18n instance with language resources and set the default language.
  4. Create Language Resource Files:

    • Create JSON files for each language in a locales directory within src.
    • Example: src/locales/en/translation.json and src/locales/es/translation.json.
  5. Wrap the Application with I18n Provider:

    • Modify src/index.js to wrap the application with the I18nextProvider and pass the i18n instance.
  6. Translate Components:

    • Use the useTranslation hook from react-i18next to translate text within components.
    • Replace hardcoded text with translation keys.
  7. Add Language Switcher:

    • Implement a language switcher component to allow users to change the language dynamically.
    • Update the i18n instance's language based on user selection.
  8. Testing:

    • Ensure that the application displays correctly in different languages.
    • Verify that the language switcher works as expected.

By following these steps, we can successfully integrate i18n support into the application, making it more accessible and user-friendly for a global audience.

Test these changes locally

git checkout -b gitauto/issue-#67-4413c6ab-ca11-4e0e-897b-999730e9e257
git pull origin gitauto/issue-#67-4413c6ab-ca11-4e0e-897b-999730e9e257
code-genius-code-coverage[bot] commented 2 months ago

The files' contents are under analysis for test generation.

sonarcloud[bot] commented 2 months ago

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ā‰„ 80%)

See analysis details on SonarCloud

github-actions[bot] commented 2 weeks ago

Infisical secrets check: :white_check_mark: No secrets leaked!

Scan results:

12:27AM INF scanning for exposed secrets...
12:27AM INF 395 commits scanned.
12:27AM INF scan completed in 1.01s
12:27AM INF no leaks found
sonarcloud[bot] commented 2 weeks ago

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ā‰„ 80%)

See analysis details on SonarCloud