flutter_translation_sheet library Null safety

Classes

AppStrings
CliConfig
EnvConfig
Model to represent the configuration (trconfig.yaml).
ExtractStringCommand
Command logic for fts extract
FetchCommand
Command logic for fts fetch
InitCommand
Command logic for fts init
LangInfo
Class to extend Locale information with nativeName, englishName and key,
ReCase
An instance of text to be re-cased.
RunCommand
Command logic for fts run
SheetParser
UpgradeCommand
Command logic for fts upgrade
VarsCap

Extensions

StringReCase

Constants

defaultConfigEnvPath β†’ const String
'trconfig.yaml'
kLangMap β†’ const Map<String, Map<String, String>>
Glossary of the available locales with their native names and english names.
<String, Map<String, String>>{'ach' : {'nativeName' : 'Lwo', 'englishName' : 'Acholi', 'emoji' : 'πŸ‡ΊπŸ‡¬'}, 'ady' : {'nati…
kRef β†’ const String
'\$ref'
kUnwrap β†’ const String
'\$unwrap'

Properties

argsJoiner ↔ String
read / write
changedWords β†’ List<String>
List of modified words captured based on reservedWords.
final
config ↔ EnvConfig
read / write
configPath ↔ String
read / write
configProjectDir β†’ String
Speculates the Flutter project dir based on the configPath location.
read-only
entryDataHasVars ↔ bool
flag that tells us if we have vars to parse or not.
read / write
extractAllowedExtensions ↔ String
read / write
extractPermissive ↔ bool
read / write
extractStringOutputFile ↔ String
read / write
invalidCharsRegExp β†’ RegExp
final
libFolder ↔ String
read / write
metaFallbackProperties ↔ Map<String, dynamic>
read / write
metaProperties ↔ Map<String, dynamic>
read / write
onlyDigitRegExp β†’ RegExp
final
reservedWords β†’ List<String>
List of Dart reserved words to be escaped in the TKeys output.
final
sheet β†’ SheetParser
final
varMatching β†’ RegExp
final
varReplacer β†’ RegExp
final
varsByKeys ↔ Map<String, dynamic>
read / write

Functions

addConfigOption(ArgParser argParser) β†’ void
Adds the config argument argParser
addLocalesInPlist() β†’ void
Keeps the iOS Info.plist locales in sync with your trconfig.yaml locales. Only runs on MacOs, as some Linux distributions have a different plutil version that throws with the arguments.
buildArb(Map<String, Map<String, String>> map) β†’ void
Creates the {locale}.arb files to be used by intl package or similar. when config.yaml has intl:enabled:true. Takes the map with all the translations to generates the files.
buildCanoMap(Map<String, dynamic> map) β†’ KeyMap
buildLocalYamlMap() β†’ JsonMap
buildPath(List<String> path) β†’ String
Shortcut utility to join paths properly in different environments.
buildVarsInMap(Map<String, String> map) β†’ void
captureVars(String str) β†’ VarsCap
checkUpdate([bool fromCommand = true]) β†’ Future<void>
Command to run from fts upgrade or automatically after all executions. Checks if there's a new version available on pub.dev and allows the user to install them.
compareSemver(String version, String other) β†’ int
Compares a version against other returns negative if version is ordered before positive if version is ordered after 0 if its the same from cli_notify
createDartExportFile(List<String> exportPaths) β†’ void
Generates the export file with the TKeys and TData files.
createLocalesFiles(Map<String, Map<String, String>> localesMap, Map<String, dynamic> masterMap) β†’ void
Generates the json and dart files according to EnvConfig.
createSampleConfig() β†’ void
createSampleContent() β†’ void
Generates the sample template content when no fts --config is provided nor trconfig.yaml is detected in the current working directory.
createTKeyFileFromMap(JsonMap map, {bool save = false, bool includeToString = true}) β†’ String
Generates the TKeys file from the map.
createTKeyFileFromPath(String masterFile, {bool save = false}) β†’ String
createTranslationFile(List<String> locales, {required List<String> imports, required List<String> translationMaps, bool save = true}) β†’ String
Generates the TData.dart and the specified locales translations as dart files.
currentVersion() β†’ Future<String?>
Returns the current fts version. Validating if it runs in local mode CliConfig.isDev, or installed as snapshot.
error(dynamic arg1, [dynamic arg2 = '', dynamic arg3 = '', dynamic arg4 = '', dynamic arg5 = '', dynamic arg6 = '', dynamic arg7 = '', dynamic arg8 = '', dynamic arg9 = '', dynamic arg10 = '']) β†’ void
prints messages to console with optional arguments using "red" pen.
extractStrings() β†’ Future<void>
Logic for fts extract
flutterHotReload() β†’ void
formatDartFiles() β†’ void
Format the selected dart folder with dartfmt if available.
getClassName(String name) β†’ String
gsheetError(GSheetsException e) β†’ void
initRun() β†’ Future<void>
joinDir(List<String> paths) β†’ String
Shortcut utility to join paths properly in different environments. Alias of buildPath
json2yaml(Map<String, dynamic> json, {YamlStyle yamlStyle = YamlStyle.generic}) β†’ String
Converts JSON to YAML representation
langInfoFromKey(String key) β†’ LangInfo
Resolve Locale information LangInfo through the locale key (es, en). Instead of null, if languageCode not found, returns an empty LangInfo
loadEnv([String path = defaultConfigEnvPath]) β†’ void
Loads the configuration file from path.
moveFile(File sourceFile, String newPath) β†’ Future<File>
Moves a file in the system in async way.
normLocale(String localeString, [String targetSeparator = '_']) β†’ String
Normalizes localeString with targetSeparator to have consistency around the naming conventions usage in the CLI (and other tools)
openJson(String filepath) β†’ JsonMap
Reads filepath as a json Map. If file doesn't exists, returns empty Map.
openString(String path) β†’ String
Reads the contents of the path file as String. If files doesn't exists, returns empty String.
openYaml(String path) β†’ String
prettyJson(dynamic json) β†’ String
Encodes a json into a tabular format for easy redeability.
printVersion() β†’ Future<void>
shows the version number in the Terminal.
putVarsInMap(Map<String, Map<String, String>> map) β†’ void
replaceVars(VarsCap vars) β†’ String
runPubGet() β†’ void
saveJson(String filepath, dynamic json, {bool beautify = false}) β†’ void
Writes json in filepath, with the option to beautify the string.
saveLocaleJsonAsset(String localeName, KeyMap map, {bool beautify = false}) β†’ void
Saves localeName translation map in EnvConfig.outputJsonDir. With the option to beautify the json string output.
saveString(String path, String content) β†’ void
Save the content in path file, creating the path if doesn't exists.
setConfig(ArgResults res) β†’ void
Reads the config from res
setCredentials({String? path, Map? json}) β†’ void
startConfig(String path) β†’ void
Initializes the supplied configuration from path
trace(dynamic arg1, [dynamic arg2 = '', dynamic arg3 = '', dynamic arg4 = '', dynamic arg5 = '', dynamic arg6 = '', dynamic arg7 = '', dynamic arg8 = '', dynamic arg9 = '', dynamic arg10 = '']) β†’ void
Prints message to console using optional arguments to avoid complex string interpolation.
upgrade() β†’ Future<void>
runs the upgrade command: fts upgrade
warning(dynamic arg1, [dynamic arg2 = '', dynamic arg3 = '', dynamic arg4 = '', dynamic arg5 = '']) β†’ void
prints messages to console with optional arguments using "orange" pen.
watchChanges() β†’ Future<void>
Watches for changes in the config.yaml and the config.entry_file basedir (where your master strings are).

Enums

YamlStyle
Original package "json2yaml" by alexei-sintotski [...]

Typedefs

JsonMap = Map<String, dynamic>
KeyMap = Map<String, String>
MapString = Map<String, String>