Skip to content

Make i18n live-reload work for default language and write-lock-free if no change #20165

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

Closed
wants to merge 5 commits into from

Conversation

wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented Jun 28, 2022

In #20096, I was going to make the live-reload for for fallback default language. But at that time I forgot this detail.

This PR fixes it, makes i18n live-reload work for the fallback default language.

Relation (difference) between #20159:

  • Allow dev i18n to be more concurrent #20159 uses a more complex approach (more mutexes and more code +100 lines) to lock everything. It makes the concurrency better in development mode update: it seems no difference now.

  • This PR uses a shared mutex to lock everything. No data-race problem, and it's very simple to be maintained in future. In development mode, there is no need for many mutexes, a shared RWMutex should work and in most time there is no write-lock, then no concurrency performance problem, so it's not worth to make code too complex.

These two PRs should have no performance difference for production mode. And they all behave the same in development mode for concurrency accesses.

Personally I usually consider about Return on Investment (ROI) and like simple approaches, so I just put the fix here, let community to choose a preferred approach. Feel free to edit on it / replace it / close it.


Update: This PR describes whether one mutex works, so the variable names are not refactored. The renaming in #20159 (eg: textMap => idxToMsgMap) is more clear than before

@wxiaoguang wxiaoguang added type/bug skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. labels Jun 28, 2022
@wxiaoguang wxiaoguang added this to the 1.18.0 milestone Jun 28, 2022
@wxiaoguang wxiaoguang force-pushed the fix-i18n-reload branch 2 times, most recently from dec4c73 to 4d3ebce Compare June 28, 2022 17:09
@wxiaoguang wxiaoguang changed the title Make i18n live-reload work for default language Make i18n live-reload work for default language and write-lock-free if no change Jun 29, 2022
@wxiaoguang
Copy link
Contributor Author

The original PR has got 2 L-G-T-M

@wxiaoguang wxiaoguang closed this Jun 30, 2022
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 30, 2022
@wxiaoguang wxiaoguang deleted the fix-i18n-reload branch June 30, 2022 01:52
@wxiaoguang wxiaoguang restored the fix-i18n-reload branch July 1, 2022 02:52
@wxiaoguang wxiaoguang deleted the fix-i18n-reload branch July 4, 2022 05:38
@lunny lunny removed this from the 1.18.0 milestone Dec 20, 2022
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants