UiLocalizations class abstract
UI-kit string catalogue.
Every user-facing string hard-coded inside a component flows
through this contract so host apps can override per locale without
reaching into the kit's source. Add new entries here (with a
default English value on UiLocalizationsEn) rather than inlining
a new "Retry" or "Back" somewhere in the components layer.
Integration — recommended
UiApp(
localizationsDelegates: const [
GlobalWidgetsLocalizations.delegate,
UiLocalizations.delegate, // <-- add this
],
supportedLocales: const [Locale('en'), Locale('ar'), Locale('fr')],
// ...
)
Reading inside a component
final strings = UiLocalizations.of(context);
return UiButton(label: strings.back);
UiLocalizations.of(context) never returns null — if the delegate
is not installed, the English defaults are used. That keeps
components working in minimal test harnesses and during app
bring-up, at the cost of not being able to catch a missing
delegate wiring at the call site. Host apps are still encouraged
to register the delegate explicitly.
Directionality
Text direction is NOT owned by this class. Flutter resolves it
from the ambient Locale, Directionality ancestor, or
UiApp.localizationsDelegates. Components should use
EdgeInsetsDirectional, AlignmentDirectional, and
Directionality.of(context) rather than branching on a locale
tag to get RTL right.
- Implementers
Constructors
- UiLocalizations()
-
const
Properties
- alertError → String
-
no setter
- alertInfo → String
-
no setter
- alertSuccess → String
-
no setter
- alertWarning → String
-
no setter
- back → String
-
Default label for the navigation back button.
no setter
- backToMonthGrid → String
-
Default hint appended when tapping would return to the month
grid from the year grid.
no setter
- cancel → String
-
Default label for a cancel action.
no setter
- close → String
-
Default label for a close affordance.
no setter
- collapseDestinations → String
-
no setter
-
Default label for collapsing an expanded navigation rail.
no setter
- confirm → String
-
Default label for a confirm action.
no setter
- customizeDestinations → String
-
no setter
- disabled → String
-
Default spoken-state suffix: "disabled".
no setter
- drawer → String
-
Spoken label for a drawer surface. Screen readers announce this
when focus enters the drawer so users understand they've moved
into a side panel.
no setter
- emptyTable → String
-
no setter
-
Default label for expanding a collapsed navigation rail.
no setter
- finishCustomizingDestinations → String
-
no setter
- formErrors → String
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- insideRange → String
-
no setter
- loading → String
-
Default label for a "loading" caption.
no setter
- loadingTable → String
-
no setter
-
Spoken label for a menu trigger.
no setter
-
monthNames
→ List<
String> -
no setter
- more → String
-
Default label for an overflow navigation item.
no setter
- next → String
-
Default label for a "next page" pagination chip.
no setter
- nextDestinations → String
-
no setter
- noOptions → String
-
no setter
- opensMonthPicker → String
-
Default hint appended to the date picker header trigger's
semantics label when tapping would open the month grid.
no setter
- opensYearPicker → String
-
Default hint appended when tapping would open the year grid.
no setter
- previous → String
-
Default label for a "previous page" pagination chip.
no setter
- previousDestinations → String
-
no setter
- pullToRefresh → String
-
Pull-to-refresh prompt shown before the trigger distance is reached.
no setter
- rangeEnd → String
-
Default spoken-state suffix for a range's end endpoint.
no setter
- rangeStart → String
-
Default spoken-state suffix for a range's start endpoint.
no setter
- refreshComplete → String
-
Live-region label after a successful refresh.
no setter
- refreshFailed → String
-
Live-region label after a failed refresh.
no setter
- refreshing → String
-
Live-region label while a refresh callback is running.
no setter
- releaseToRefresh → String
-
Pull-to-refresh prompt shown after the gesture is armed.
no setter
- reorderDestinationsHint → String
-
no setter
- retry → String
-
Default label for a retry affordance (empty / error states).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- searchOptions → String
-
no setter
- selected → String
-
Default spoken-state suffix: "selected".
no setter
- sheet → String
-
Spoken label for a sheet surface.
no setter
-
shortMonthNames
→ List<
String> -
no setter
-
shortWeekdayNames
→ List<
String> -
no setter
- showAllDestinations → String
-
no setter
- slider → String
-
no setter
- today → String
-
Default spoken-state suffix: "today".
no setter
-
weekdayNames
→ List<
String> -
Monday first, matching DateTime.weekday.
no setter
Methods
-
activeSelection(
String label, int count) → String -
dateLabel(
DateTime date) → String -
destinationSet(
int index, int count) → String -
moveDestination(
String label) → String -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pageSemanticsLabel(
int page) → String -
Spoken label for a pagination chip pointing to
page. The English default renders"Page 3". Override for locales where the unit word takes a different position relative to the number. -
ratingLabel(
String value, int count) → String -
removeSelection(
String label) → String -
selectionCount(
int count) → String -
swapDestination(
String label) → String -
textSelectionAction(
ContextMenuButtonType type) → String -
toString(
) → String -
A string representation of this object.
inherited
-
typingLabel(
List< String> names) → String - Formats the presence message for participants composing a chat message.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
of(
BuildContext context) → UiLocalizations -
Resolve the active localization for
context. When no delegate is installed, UiLocalizationsEn is returned so components keep working during test and bring-up.
Constants
-
delegate
→ const LocalizationsDelegate<
UiLocalizations> -
The delegate to register in
UiApp.localizationsDelegates.