arb_utils library
A library with tools for handling .arb files
Classes
- ArbClient
- An object that handles translations dynamically, by processing the .arb JSON on demand.
Functions
-
addMissingMetadata(
String arbContents) → String - Adds any missing default metadata for keys
-
diffARBs(
String arb1Contents, String arb2Contents) → String -
Generates a .arb String with the results of differencing
arb1Contents
witharb2Contents
: if both the key and it's value are the same that tuple will be omitted of the result. -
mergeARBs(
String arb1Contents, String arb2Contents) → String -
Includes the novel keys of
arb2Contents
in thearb1Contents
and returns the result of the merge. In case of discrepances of the values for the same key, thearb2Contents
will prevail -
processNewKeys(
String mainARB, String oldARBversion) → String -
Processes the new/edited keys of the
mainARB
input (which should be the .arb used to add new keys in the developed app) comparing it with the .arb formattedoldARBversion
and produces a .arb containing them as the output -
sortARB(
String arbContents, {int compareFunction(String, String)?, bool caseInsensitive = false, bool naturalOrdering = false, bool descendingOrdering = false}) → String -
Sorts the .arb formatted String
arbContents
in alphabetical order of the keys, with the @key portion added below it's respective key Optionally you can provide acompareFunction
for customizing the sorting. For simplicity sake there are common sorting features you can use when not defining the former parameter
Typedefs
- MissingKeyCallback = void Function(String key)
- MissingKeyDefaultValue = String Function(String key)