Loc class
A simple localization class that reads translations from an Excel file.
Usage:
// Initialize Loc with the initial language
await Loc.initialize('assets/translations.xlsx', 'en');
// Get a translated value
String helloTranslation = Loc.get('hello_key');
Constructors
- Loc.new()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- 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
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
changeLocale(
String filePath, String newLanguage) → Future< void> - Changes the current language and reloads translations from the Excel file.
-
get(
String key) → String - Retrieves the translated value for the specified key and current language.
-
initialize(
String filePath, String currentLanguage) → Future< void> - Initializes the Loc class with translations from the specified Excel file.