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

Feature/pxweb2-41 install i18next #61

Merged
merged 7 commits into from
Mar 5, 2024

Conversation

SjurSutterudSagen
Copy link
Contributor

Adds language functionality to the app. More specifically, this PR adds support for languages, language files, ability to change document direction to support right-to-left languages and basic date formatting.

One thing to note is that we turned off caching of the translation files for now. This was done because, if you deploy the app to an IIS server and edit the translation files, the caching stopped the page from updating with the new values.

There is more work to do when it comes to regions and formatting of dates/numbers. The challenge here is that the same language can have different formatting in different regions: 'en-US' vs 'en-CA' vs 'en-GB'. But i18n might default to just 'en' in some cases, and this can give inconsistent formatting.

This PR contains work for PXWEB2-41, PXWEB2-97 and PXWEB2-98.

MikaelNordberg and others added 5 commits February 28, 2024 13:55
Since we want to support multiple languages in the application, we need
to add translation files for the languages we want to support. We also
need to add a configuration file for i18next, which is the library we
use for translations.
Since site administrators may want to change translations we cannot
cache the translation files.
Since we need to support right-to-left languages, we need to implement
support for document direction. We also added arabic as a language,
since we need an rtl language.

We did not add plurals or numbers or date support yet.

Mikael Nordberg <>
Since we want to support changing how dates are formatted, we need to
set that up with i18next. This commit adds only a very basic date
formatter, but it might be enough.

Mikael Nordberg <>
Add a date formatted with both the date and the time of day.

Mikael Nordberg <>
@SjurSutterudSagen SjurSutterudSagen requested review from a team February 29, 2024 09:38
Add a basic suspense component around the App, to show loading state for
requests the server makes.

Co-authored-by: Mikael Nordberg <>
Copy link

cloudflare-workers-and-pages bot commented Mar 4, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8f6daae
Status: ✅  Deploy successful!
Preview URL: https://6e7b5056.pxweb2.pages.dev
Branch Preview URL: https://feature-pxweb2-41-install-i1.pxweb2.pages.dev

View logs

Since the date formatting works the same in all languages, we do not
need separate date formatting for different languages. i18next uses the
right one even if it is only specified in the fallback language.
@SjurSutterudSagen SjurSutterudSagen merged commit 8689c73 into main Mar 5, 2024
1 check passed
@SjurSutterudSagen SjurSutterudSagen deleted the feature/PXWEB2-41-Install-i18next branch March 5, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants