Skip to content

feat(TextBase): localized text transform#11302

Merged
NathanWalker merged 6 commits into
NativeScript:mainfrom
CatchABus:fix/localized-text-transform
Jul 16, 2026
Merged

feat(TextBase): localized text transform#11302
NathanWalker merged 6 commits into
NativeScript:mainfrom
CatchABus:fix/localized-text-transform

Conversation

@CatchABus

@CatchABus CatchABus commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

Right now, CSS text-transform property does not respect locale.
This results in incorrect text casing for languages other than English.

What is the new behavior?

CSS text-transform property will respect current locale (can be changed using native apis).
This PR also contains a new and accurate capitalization function to ensure capitalize is identical in both platforms (inspired by Apache WordUtils.capitalize).

Users can also use @nativescript/localize or @nativescript-community/l plugins to switch locale to one of their own and text-transform will respect that.
For @nativescript/localize, use overrideLocale and androidLaunchEventLocalizationHandler functions.
For @nativescript-community/l, use overrideNativeLocale function.

@nx-cloud

nx-cloud Bot commented Jul 4, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 3c8e2fa

Command Status Duration Result
nx test apps-automated -c=ios ✅ Succeeded 2m 37s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded 2s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-07-16 00:19:23 UTC

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds locale-aware casing for CSS text-transform in TextBase, using platform-native localized casing APIs (iOS) and Java-side casing/capitalization helpers (Android) to improve correctness for non-English locales.

Changes:

  • iOS: switch uppercase/lowercase/capitalize to localizedUppercaseString, localizedLowercaseString, and localizedCapitalizedString.
  • Android: route transformations through org.nativescript.widgets.Utils and introduce a shared Java capitalization implementation.
  • Update Android type definitions to expose the new Utils string APIs; lockfile updated accordingly.

Reviewed changes

Copilot reviewed 3 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/ui-mobile-base/android/widgets/src/main/java/org/nativescript/widgets/Utils.java Adds Java-side string transform helpers used by TextBase, including a new capitalizeString implementation.
packages/types-android/src/lib/android/org.nativescript.widgets.d.ts Exposes the new Utils string transform helpers to TypeScript/JS.
packages/core/ui/text-base/index.ios.ts Uses localized NSString casing APIs to respect current locale for text transforms.
packages/core/ui/text-base/index.android.ts Switches text transforms to call into Java Utils helpers (instead of JS casing).
package-lock.json Updates lockfile entries (dependency tree reshaping).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +580 to 582
// Use the java string methods to get localized transformations.
// This will respect the locale set by native apis or the localize plugins.
switch (textTransform) {
@CatchABus
CatchABus force-pushed the fix/localized-text-transform branch from 3c8e2fa to 91ea568 Compare July 16, 2026 00:13
@NathanWalker
NathanWalker merged commit da12301 into NativeScript:main Jul 16, 2026
4 of 6 checks passed
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.

3 participants