Skip to content

Add Portuguese (pt) language support to VoloDocs - #26206

Open
VitorMachado-vmp wants to merge 1 commit into
abpframework:rel-10.7from
Vimaponto:pt-localization
Open

VitorMachado-vmp wants to merge 1 commit into
abpframework:rel-10.7from
Vimaponto:pt-localization

Conversation

@VitorMachado-vmp

Copy link
Copy Markdown
Contributor

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.json never passes the app's culture check, and gets
stuck in an infinite redirect loop between the project page and
/Abp/Languages/Switch, since the requested culture is never
recognized as supported.

A "pt" translation resource
(Localization/Resources/VoloDocs/Web/pt.json) was already added in
a 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.json declares "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" to AbpLocalizationOptions.Languages, the same project
loads normally with no redirect loop.

Change

  • Added LanguageInfo("pt", "pt", "Português").
  • Renamed the "pt-BR" display name to "Português (Brasil)" to
    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 loads
correctly, without the redirect loop.

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.
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.

1 participant