MultiLanguage class

A class that manages the loading and parsing of multi-language JSON files from a specified directory path. The MultiLanguage class provides functionality to load, read, and parse JSON files to create a map structure representing different language data. Example usage:

final multiLanguage = MultiLanguage('/path/to/languages');
final translations = await multiLanguage.init();

Constructors

MultiLanguage({String languagePath = '', LanguageSource source = LanguageSource.json, Map<String, Map<String, String>> dartLanguages = const {}})
Creates an instance of MultiLanguage with the given languagePath.

Properties

dartLanguages Map<String, Map<String, String>>
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
languagePath String
The directory path where the language JSON files are stored.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
source LanguageSource
getter/setter pair

Methods

init() Future<Map<String, Map<String, String>>>
Initializes the multi-language system by reading all JSON files from the directory and subdirectories specified in languagePath.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readFile(String path, Map<String, Map<String, String>> result) Future<Map<String, Map<String, String>>>
Reads and parses a JSON file at the given path and merges its data into result.
toString() String
A string representation of this object.
inherited

Operators

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