read method

Future<FileConfig> read(
  1. String languageTag, {
  2. String? fileName,
})

Reads a locale file.

Implementation

Future<FileConfig> read(
  String languageTag, {
  String? fileName,
}) async {
  final filePath = p.joinAll([
    ...translationsDirPath,
    fileName ?? '$languageTag.${fileType.extension}',
  ]);
  final fileConfig = FileConfig(
    ref: ConfigFileRef(
      ref: languageTag,
      type: fileType,
      read: () => fileReader(filePath),
    ),
    settings: const ReplacePatternsSettings(caseSensitive: false),
  );
  await TranslationManager().setFileConfig(fileConfig);
  return fileConfig;
}