Add Portuguese (pt) language support to VoloDocs - #26206
Open
VitorMachado-vmp wants to merge 1 commit into
Open
VitorMachado-vmp wants to merge 1 commit into
VitorMachado-vmp wants to merge 1 commit into
Conversation
VoloDocs only registered "pt-BR" as a supported culture in VoloDocsWebModule, even though a "pt" localization resource file (Localization/Resources/VoloDocs/Web/pt.json) already exists. Any Docs project configured with a "pt" language (via its docs-langs.json) triggers an infinite redirect loop between the project page and /Abp/Languages/Switch, because the app never recognizes "pt" as a valid culture and silently falls back to the default one on every request.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Adds "pt" (neutral Portuguese) as a supported culture in
VoloDocsWebModule, alongside the existing "pt-BR".Why
VoloDocs only registers "pt-BR" in
Configure<AbpLocalizationOptions>.Any Docs project that declares "pt" (not "pt-BR") in its
docs-langs.jsonnever passes the app's culture check, and getsstuck in an infinite redirect loop between the project page and
/Abp/Languages/Switch, since the requested culture is neverrecognized as supported.
A "pt" translation resource
(
Localization/Resources/VoloDocs/Web/pt.json) was already added ina previous contribution, but the culture itself was never registered,
so it had no effect for projects using the neutral "pt" code.
Reproduction
Log captured against a project whose
docs-langs.jsondeclares"code": "pt",before this fix. The request never resolves, it loops continuously between
the project page and the language switch endpoint:
[17:48:43 INF] Request starting HTTP/2 GET https://localhost:5001/documents/pt/vmpdot/latest
[17:48:43 INF] Executed handler method OnGetAsync, returned result Microsoft.AspNetCore.Mvc.RedirectResult.
[17:48:43 INF] Executing RedirectResult, redirecting to /Abp/Languages/Switch?culture=pt&uiCulture=pt&returnUrl=/documents/pt/vmpdot/latest.
[17:48:43 INF] Request finished HTTP/2 GET https://localhost:5001/documents/pt/vmpdot/latest - 302 0 null 74.6936ms
[17:48:43 INF] Request starting HTTP/2 GET https://localhost:5001/Abp/Languages/Switch?culture=pt&uiCulture=pt&returnUrl=/documents/pt/vmpdot/latest
[17:48:43 INF] Executing action Volo.Abp.AspNetCore.Mvc.Localization.AbpLanguagesController.Switch
[17:48:44 INF] Executing RedirectResult, redirecting to /documents/pt/vmpdot/latest.
[17:48:44 INF] Request finished HTTP/2 GET https://localhost:5001/Abp/Languages/Switch?culture=pt&uiCulture=pt&returnUrl=/documents/pt/vmpdot/latest - 302 0 null 57.3398ms
[17:48:44 INF] Request starting HTTP/2 GET https://localhost:5001/documents/pt/vmpdot/latest
[17:48:44 INF] Executing RedirectResult, redirecting to /Abp/Languages/Switch?culture=pt&uiCulture=pt&returnUrl=/documents/pt/vmpdot/latest.
[17:48:44 INF] Request finished HTTP/2 GET https://localhost:5001/documents/pt/vmpdot/latest - 302 0 null 58.2862ms
[17:48:44 INF] Request starting HTTP/2 GET https://localhost:5001/Abp/Languages/Switch?culture=pt&uiCulture=pt&returnUrl=/documents/pt/vmpdot/latest
[17:48:44 INF] Executing RedirectResult, redirecting to /documents/pt/vmpdot/latest.
[17:48:44 INF] Request finished HTTP/2 GET https://localhost:5001/Abp/Languages/Switch?culture=pt&uiCulture=pt&returnUrl=/documents/pt/vmpdot/latest - 302 0 null 18.3933ms
(pattern repeats continuously, captured log runs unbroken for ~3 minutes
before the request was manually aborted from the browser)
After adding
"pt"toAbpLocalizationOptions.Languages, the same projectloads normally with no redirect loop.
Change
LanguageInfo("pt", "pt", "Português").disambiguate it from the new "pt" entry in the language switcher.
Testing
Verified locally with a self-built VoloDocs.Web that a Docs project
configured with
docs-langs.json→"code": "pt"now loadscorrectly, without the redirect loop.