NyLocalization class
NyLocalization Singleton object that handles localization in Nylo
Properties
-
delegates
→ Iterable<
LocalizationsDelegate> -
Returns app delegates.
used in app entry point e.g. MaterialApp()
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- languageCode → String
-
Returns language code as string
no setter
- locale → Locale
-
Returns locale code as Locale
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getAllKeys(
) → List< String> - Get all available translation keys (for debugging)
-
hasTranslation(
String key) → bool - Check if a translation key exists
-
init(
{LocaleType localeType = LocaleType.asDefined, required String languageCode, String assetsDirectory = 'lang/'}) → Future< void> - Initialize NyLocalization with the specified configuration.
-
isDirectionRTL(
BuildContext context) → bool -
Returns
trueif the active language direction is RTL. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
restart(
BuildContext context) → void - reloads the app
-
setDebugMissingKeys(
bool enabled) → void - Enable or disable debug logging for missing translation keys
-
setLanguage(
BuildContext context, {required String language, bool restart = true}) → Future< void> - Changes the active language and optionally restarts the app.
-
setLocale(
{required Locale locale}) → Future< void> - Changes the locale without restarting the app.
-
toString(
) → String -
A string representation of this object.
inherited
-
translate(
String key, [Map< String, String> ? arguments]) → String - Translates a key to its localized string value. Supports nested keys using dot notation (e.g., "section.greeting"). Supports argument interpolation using {{argName}} syntax.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → NyLocalization
-
final