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
arb1Contentswitharb2Contents: 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
arb2Contentsin thearb1Contentsand returns the result of the merge. In case of discrepances of the values for the same key, thearb2Contentswill prevail -
processNewKeys(
String mainARB, String oldARBversion) → String -
Processes the new/edited keys of the
mainARBinput (which should be the .arb used to add new keys in the developed app) comparing it with the .arb formattedoldARBversionand 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
arbContentsin alphabetical order of the keys, with the @key portion added below it's respective key Optionally you can provide acompareFunctionfor 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)