flutter_translation_sheet
library
Enums
-
YamlStyle
-
Original package "json2yaml" by alexei-sintotski
Functions
-
addAssetsToPubSpec()
→ void
-
Adds the json files directory. to pubspec.yaml assets.
-
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
Doesnt considere incremental builds +VALUE
0 if its the same
from cli_notify
-
createDartExportFile(List<String> exportPaths)
→ void
-
Generates the export file with the TKeys and TData files.
-
createFtsUtilsFile()
→ void
-
-
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()
→ 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.
-
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
-
-
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, YamlMap? parsedDoc})
→ 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
-
-
readPubSpec()
→ void
-
Reads the pubspec.yaml file and stores it in pubSpecStr and pubSpecMap
-
replaceVars(VarsCap vars)
→ String
-
-
runPubGet()
→ void
-
-
sanitizeLocale(String locale, {bool throwOnError = false, bool verbose = true})
→ String
-
-
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).