Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Unfortunately, the current version of Perseus has a critical issue in its global state system: we support locale-dependent global state. This means you can generate a different global state for
en-US
,fr-FR
,zh-CN
, etc., which, although there are no immediately obvious use-cases, seemed like a good idea at the time. I have to apologize then for this PR, which removes this feature totally in favor of unlocalized global state, after #267 was reported, which shows that, not only does localized global state fail with the locale redirection system, in its current form, it is also incompatible with locale switching. This means that, if a user switches fromen-US
tofr-FR
, the global state held in the browser will still be that foren-US
. Adding state thawing to this issue only increases the complexity of a solution.In light of all this, there are two solutions to the problem:
In my view, as the maintainer, option 2 is not only significantly more complex, but also more opaque, and substantially more difficult to communicate to new users: forcing anyone who uses global state and internationalization to define some magical function does not seem user-friendly to me at all.
Therefore, I have decided to implement option 1, which means the following:
locale
parameter from their global state generation functionsThe last one of these constitutes a breaking change for all users, while the second-last of these is by far the most impactful consequence of this change. To any users currently using locale-dependent global state, I can only sincerely apologize for this: I hate removing features, and, in general, I am careful to only implement features I am confident won't need to ever be rolled-back. In this case, I made a mistake. Again, I am sorry for this, but I think it's the best decision for the project as a whole in the longer-term (maintaining a version of Perseus that uses option 2, as outlined above, would, in my view, become extremely burdensome for future contributors). To replace locale-dependent global state, I would recommend the translations system, which, in extreme cases, or as a temporary patch mechanism, can be used to store structured data if absolutely necessary (since a custom
TranslationsManager
can be provided). Any users needing help with fixing their own systems after this change should join our Discord server, and we will be more than happy to help.This PR's description is deliberately long to justify this change to any users adversely impacted by it (despite the fact that I am not aware of any usage of locale-dependent global state in the wild). I don't think this change will have a significant impact on the Perseus community at large, but, from personal experience with other projects, if there is even one user who was using locale-dependent global state, they deserve a proper explanation of why the rug is being yanked out underneath them.
This PR closes #267.