Skip to content

Making localization sync#219

Merged
jdesrosiers merged 6 commits intohyperjump-io:mainfrom
Ahmedmhmud:making-Localization-sync
Apr 29, 2026
Merged

Making localization sync#219
jdesrosiers merged 6 commits intohyperjump-io:mainfrom
Ahmedmhmud:making-Localization-sync

Conversation

@Ahmedmhmud
Copy link
Copy Markdown
Contributor

For #216,Localization.forLocale can be synchronous if we get rid of the async reading and this PR solves the problem of relying on ftl files by removing them entirely and replacing them with JS module that has the same content and can be imported and by relying on JS module, we can safely switching Localization.forLocale to synchronous

Copy link
Copy Markdown
Collaborator

@jdesrosiers jdesrosiers left a comment

Choose a reason for hiding this comment

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

Let's make it one file per locale like it was, just make it .js instead of .ftl. Then translations.js should import each locale file to construct the map.

Comment thread src/translations.js Outdated
} matched
not-message = Expected a value that doesn't match the 'not' schema
`,
"fx-TR": `test = unsupported locale`
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You can't put text fixtures here because it will be usable outside of tests as well.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is still a problem. You need to handle test fixtures in a way that doesn't make them available to users.

@Ahmedmhmud
Copy link
Copy Markdown
Contributor Author

Hi @jdesrosiers , I did isolate locales and construct the map in translations.js

@Ahmedmhmud
Copy link
Copy Markdown
Contributor Author

Now, It is abstracted as before but using the map to avoid file operations that requires async pipeline
I deleted the fx-TR file to prevent exposing tesing details and imported translations map to apply runtime operations for testing using beforeAll & afterAll

@jdesrosiers jdesrosiers merged commit c78caff into hyperjump-io:main Apr 29, 2026
1 check passed
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.

2 participants