I18Next class

It translates the i18next localized format in your localization objects (provided by resourceStore) to the final translation.

Usually the most common usage:

// {
//   "key": "My text",
//   "nested": { "key": "My nested text" }
// }
I18Next.localization('key') // -> 'My text'
I18Next.localization('nested.key') // -> 'My nested text'

It also allows the usage of namespaces (as long as they are provided by dataSource:

// common.json
// { "continue": "Continue" }
// feature.json
// { "title": "My feature Title" }
I18Next.t('common:continue') // -> 'Continue'
I18Next.t('feature:title') // -> 'My feature title'

Constructors

I18Next(Locale locale, ResourceStore resourceStore, {I18NextOptions? options})

Properties

hashCode int
The hash code for this object.
no setterinherited
locale Locale
The current and default Locale for this instance.
final
options I18NextOptions
The options used to find and format matching interpolations.
final
pluralResolver → PluralResolver
The pluralization resolver.
final
resourceStore ResourceStore
The resources store that contains all the necessary values mapped by Locale, namespace, and keys.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
t(String key, {Locale? locale, String? context, int? count, Map<String, dynamic>? variables, I18NextOptions? options, String orElse(String)?}) String
Attempts to retrieve a translation at key.
tOrNull(String key, {Locale? locale, String? context, int? count, Map<String, dynamic>? variables, I18NextOptions? options}) String?
Attempts to retrieve a translation at key. Returns null if the translation cannot be found.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

of(BuildContext context) I18Next?
Returns the localized I18Next in the widget tree that corresponds to the given context via Localizations.