Localization- change all printed text #861

Closed
opened 2026-05-11 07:48:36 +00:00 by c24danli · 6 comments
Collaborator

In the test #830 it worked so now we will introduce localization to all files/ all printed text
Skärmbild 2026-05-11 085621

In the locales dictionary we have a json file for en & sv.
When creating keys make sure that the keys are descriptive and pressent in both the files.
en.json

{
	"language": "Language"
}

sv.json

{
	"language": "Språk"
}

Right now we have one locales file as we dont have that much text to print but it can be a good idea to structure the files with comments to make it easier to break out if the need comes.
ex

{
    // Settings page
	"language": "Language"

    // tempratureView
    "tempTitle": "Temperature"
    "tempDescript": "This is recoreded by sesnosrs around campus"
}

Skärmbild 2026-05-11 093127
The key is accessed with translate('key')

In the test #830 it worked so now we will introduce localization to all files/ all printed text ![Skärmbild 2026-05-11 085621](/attachments/86001268-23cb-4a51-81be-e23e18914eb6) In the locales dictionary we have a json file for en & sv. When creating keys make sure that the keys are descriptive and pressent in both the files. en.json ``` { "language": "Language" } ``` sv.json ``` { "language": "Språk" } ``` Right now we have one locales file as we dont have that much text to print but it can be a good idea to structure the files with comments to make it easier to break out if the need comes. ex ``` { // Settings page "language": "Language" // tempratureView "tempTitle": "Temperature" "tempDescript": "This is recoreded by sesnosrs around campus" } ``` ![Skärmbild 2026-05-11 093127](/attachments/06528f90-3b95-4358-b911-ac873183ca41) The key is accessed with translate('key')
Collaborator

The documentation here is a little vague, so for future reference:

First, any and all pages that use the translate function, MUST have the following import declaration.
import { useLanguage } from '../features/useLanguage';
And any function invoking translate MUST fetch the following constant.
const { translate } = useLanguage();

Not doing this will generate an "undefined" error for translate, at build-time.

Additionally comments are NOT allowed inside JSON files, and will break them. Keys must also be separated by a comma ",".

The documentation here is a little vague, so for future reference: First, any and all pages that use the translate function, MUST have the following import declaration. `import { useLanguage } from '../features/useLanguage';` And any function invoking translate MUST fetch the following constant. `const { translate } = useLanguage();` Not doing this will generate an "undefined" error for translate, at build-time. Additionally comments are NOT allowed inside JSON files, and will break them. Keys must also be separated by a comma ",".
f21marfo added reference #861-Localization-change-all-printed-text 2026-05-11 13:06:22 +00:00
Collaborator

I have completed localization work on the following pages.

  • Settings
  • Support
  • About us

These changes can be previewed in the corresponding branch #861, if anyone is curious, will be resuming work tomorrow.

I have completed localization work on the following pages. - Settings - Support - About us These changes can be previewed in the corresponding branch #861, if anyone is curious, will be resuming work tomorrow.
f21marfo changed reference from #861-Localization-change-all-printed-text to #861-Localization-change-all-printed-text 2026-05-15 07:30:00 +00:00
f21marfo changed reference from #861-Localization-change-all-printed-text to #861-localization-change-all-printed-text-Part-2 2026-05-15 07:30:16 +00:00
Collaborator

Update:

At present, I "believe" i have now localized everything visible post-merge, with the exception of the cards themselves. There are currently a number of issues open on them, and I think it best that the people working on structuring and re-organizing them, should be the ones to localize them, in order to minimize conflicts.

If this seems agreeable, i will go ahead and make a pull-request for this last batch of changes, and consider my work on this issue completed.

**Update:** At present, I "believe" i have now localized everything visible post-merge, with the exception of the cards themselves. There are currently a number of issues open on them, and I think it best that the people working on structuring and re-organizing them, should be the ones to localize them, in order to minimize conflicts. If this seems agreeable, i will go ahead and make a pull-request for this last batch of changes, and consider my work on this issue completed.
Author
Collaborator

It seems as a good approach, when your pr is approved and merged will i add to the review template to check localization where we will hopefully get the once left and future instances discovered.

It seems as a good approach, when your pr is approved and merged will i add to the review template to check localization where we will hopefully get the once left and future instances discovered.
Collaborator
@c24danli https://git.webug.se/Andras/BoundlessFlowCampus2K/commit/50af70334b3a7d214e0b673f57c9c6dc505e2232 can we close issue?
Author
Collaborator

we have new issues for the remaining translations so i will close this issue

we have new issues for the remaining translations so i will close this issue
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Andras/BoundlessFlowCampus2K#861
No description provided.