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

Persist default locale #13

Merged
merged 6 commits into from
Sep 23, 2024
Merged

Persist default locale #13

merged 6 commits into from
Sep 23, 2024

Conversation

virolea
Copy link
Owner

@virolea virolea commented Sep 23, 2024

The first version of the default locale feature a non-persisted instance of Rosetta::Locale. It made sense since the convention in Rosetta is that your default locale is the locale the codebase is written in. Therefore there should be no need for a persisted default locale.

However, work on #10 showed that in order to have a common pluralization API, pluralized translations need to be stored, even for the default locale. Therefore it needs to be persisted.

This PR implements a new workflow around default locales. Any installation of Rosetta without a persisted default locale will now redirect to default_locales#new. A new boolean default is added to the rosetta_locales table to set the default locale.

The default locale is memoized in Rosetta::Locale.default_locale.

The default Locale should not change in theory. It should only be set once.

  • Update README

@virolea virolea marked this pull request as ready for review September 23, 2024 13:35
@virolea virolea merged commit 16f323c into main Sep 23, 2024
16 checks passed
@virolea virolea deleted the persist-default-locale branch September 23, 2024 13:45
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.

1 participant