codeconsole opened a new pull request, #16053: URL: https://github.com/apache/grails-core/pull/16053
## What `g:localeSelect` gains a ready-made language menu and a display-cased name, and the generated layouts stop hand-rolling either. ## Why CLDR stores a language's autonym in its **mid-sentence** form, and `Locale.getDisplayName` never applies context transforms. The generated language menu therefore listed: > English, Deutsch, Nederlands, dansk, español, français, italiano, norsk bokmål, polski, português (Brasil), slovenčina, svenska, čeština, русский Whether a language capitalizes its own name is an orthographic rule of that language, so the data is correct — a menu simply is not a sentence. CLDR covers exactly this with a `uiListOrMenu` context transform of `titlecase-firstword`. ## Changes **`menuName` in the body model** — the autonym titlecased for standalone display. Uppercased with the locale's *own* casing rules rather than the JVM default, so Turkish and Azeri produce the dotted `İ`; caseless scripts (`ไทย`, `中文`, `日本語`) and already-capitalized names pass through untouched. `autonym` is unchanged and remains the faithful CLDR form for prose. **`type="dropdown"`** — renders the whole navbar language menu with no body: toggle, menu, the pinned default above a divider, the active entry, and titlecased names. It self-suppresses when the application has a single locale, so callers no longer guard on `availableLocales` themselves. The skeleton and forge layouts collapse from ~30 lines to: ```gsp <g:localeSelect available="true" pinDefault="true" type="dropdown"/> ``` **Bootstrap by default, not mandatory.** Following `ApplicationTagLib`'s `flashMessages` classes, every class is an injectable property with a matching per-invocation attribute — `navItemClass`, `toggleClass`, `icon`, `menuClass`, `itemClass`, `activeClass`, `dividerClass`, plus `id` and `param`. Supplying a body still gives full control for layouts on another CSS framework, and a test asserts no Bootstrap default leaks through when the attributes are set. **Bug fix:** `var` with no body silently rendered one empty string per locale. GSP passes an absent body as `TagOutput.EMPTY_BODY_CLOSURE`; that is now detected and the tag falls back to the requested `type`. ## Compatibility Additive. `type` still defaults to `select`, the existing `select` and `links` renderings are untouched, and `autonym` keeps its current value. Existing templates are unaffected. ## Tests - `LocaleSelectRenderingSpec` — 6 new cases covering `menuName` casing (including a non-Latin script and a caseless one), `type="dropdown"` rendering, class overrides, single-locale suppression, and the `var`-without-body fallback; the existing body-form case now uses `menuName`. Full `:grails-gsp:test` suite green. - `GrailsGspSpec` — updated for the collapsed layouts; 19/19 green, including `test the profile skeleton mirrors the forge welcome templates`, which keeps the two templates identical. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
