Skip to content
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 translation request backend integration #2168

Merged
merged 39 commits into from
Mar 12, 2024

Conversation

ugur-vaadin
Copy link
Contributor

@ugur-vaadin ugur-vaadin commented Mar 4, 2024

Description

This PR:

  • implements default backend integration for translation requests
  • adds an i18n Spring test project
  • adds ITs for the test project

Fixes #2103

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.
  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

@CLAassistant
Copy link

CLAassistant commented Mar 4, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

codecov bot commented Mar 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.78%. Comparing base (def33e6) to head (522a929).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2168   +/-   ##
=======================================
  Coverage   93.77%   93.78%           
=======================================
  Files          64       64           
  Lines        1622     1624    +2     
  Branches      364      365    +1     
=======================================
+ Hits         1521     1523    +2     
  Misses         66       66           
  Partials       35       35           
Flag Coverage Δ
unittests 93.78% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ugur-vaadin ugur-vaadin force-pushed the feat-translation-request-backend-integration branch from e10709e to 1ba2f46 Compare March 6, 2024 07:46
@ugur-vaadin ugur-vaadin marked this pull request as ready for review March 6, 2024 07:58
@@ -39,6 +39,7 @@
"@vaadin/hilla-react-auth": "file:../../../../ts/react-auth",
"@vaadin/hilla-react-crud": "file:../../../../ts/react-crud",
"@vaadin/hilla-react-form": "file:../../../../ts/react-form",
"@vaadin/hilla-react-i18n": "file:../../../../ts/react-i18n",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really sure if the changes in this file is really necessary.

@@ -11,6 +11,7 @@
"@vaadin/hilla-react-auth": "file:../../../../ts/react-auth",
"@vaadin/hilla-react-crud": "file:../../../../ts/react-crud",
"@vaadin/hilla-react-form": "file:../../../../ts/react-form",
"@vaadin/hilla-react-i18n": "file:../../../../ts/react-i18n",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really sure if the changes in this file is really necessary.

@@ -0,0 +1,20 @@
import { i18n, translate } from '@vaadin/hilla-react-i18n';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package here is _views instead of just views. The reason is to align with the similar temporary changes in the other test modules.

…NView.tsx

Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>
sissbruecker
sissbruecker previously approved these changes Mar 7, 2024
platosha
platosha previously approved these changes Mar 12, 2024
Copy link

sonarcloud bot commented Mar 12, 2024

Quality Gate Passed Quality Gate passed

Issues
2 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.3% Duplication on New Code

See analysis details on SonarCloud

@platosha platosha merged commit 631e8aa into main Mar 12, 2024
15 checks passed
@platosha platosha deleted the feat-translation-request-backend-integration branch March 12, 2024 17:34
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Hilla 24.4.0.alpha14 and is also targeting the upcoming stable 24.4.0 version.

cromoteca added a commit that referenced this pull request Mar 14, 2024
* add basic configuration features

* change implementation to use signals

* update tests

* add global instance

* add global translate function

* remember last used language

* add React integration tests

* remove unnecessary eslint suppression

* update package.json

* use fetch-mock to mock backend calls

* refactor to use private properties

* add missing test coverage

* update package-lock.json

* fix dependency versions

* feat: add backend integration for translation requests

* test: use default initial configuration for the tests

* test: refactor tests and wait before assertions

* feat: allow configuration for filtering based on retrieved locales

* refactor: add resolved language signal and remove response types

* fix: apply recent fixes on test project

* chore: update package json

* refactor: add resolved language getter and assertions

* refactor: await fetch result and make block flatter

* test: use language signals to wait for the translation update

* test: remove unused mock case and add test for undefined resolved language

* Update packages/java/tests/spring/react-i18n/frontend/_views/BasicI18NView.tsx

Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>

---------

Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>
Co-authored-by: Anton Platonov <platosha@gmail.com>
Co-authored-by: Luciano Vernaschi <luciano@vaadin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[i18n] Load translations from backend
6 participants