arb_merge 1.0.1 copy "arb_merge: ^1.0.1" to clipboard
arb_merge: ^1.0.1 copied to clipboard

A command-line tool to merge ARB files from multiple sources based on the files' locale.

example/README.md

Using arb_merge #

How to use arb_merge to merge multiple language files into a single ARB format file.

Input Files #

Suppose we have the following directory structure containing language files:

.
└── example/
    ├── merged/
    ├── primarySource/
    │   ├── en.arb
    │   └── intl_french.arb
    |   ├── nestedFolder/
    |   |    └── more_translations_english.json
    └── secondarySource/
        ├── intl_en.arb
        └── intl_fr.arb

Contents of example/primarySource/en.arb

{
  "@@locale": "en",
  "hello": "Hello"
}

Contents of example/primarySource/nestedFolder/more_translations_english.json

{
   "@@locale": "en",
   "howDoYouDo": "How do you do?"
 }

Contents of example/secondarySource/intl_en.arb

{
  "@@locale": "en",
  "one": "one",
  "two": "two",
  "three": "three"
}

Using arb_merge #

To merge these files using arb_merge, follow these steps:

  1. Execute arb_merge:

    dart run arb_merge --sources example/primarySource,example/secondarySource --destination example/merged --pattern intl_{lang}.arb --sort

  2. Verify Output: After executing arb_merge, the directory structure will be updated as follows:

     .
     └── example/
         ├── merged/
         |   ├── intl_en.arb
         │   └── intl_fr.arb
         ├── primarySource/
         │   ├── en.arb
         │   └── intl_french.arb
         |   ├── nestedFolder/
         |   |    └── more_translations_english.json
         └── secondarySource/
             ├── intl_en.arb
             └── intl_fr.arb
    

Output ARB Files #

Contents of intl_en.arb:

{
  "@@locale": "en",
  "hello": "Hello {name}!",
  "@hello": {
    "placeholders": {
      "name": {
        "type": "String"
      }
    }
  },
  "howDoYouDo": "How do you do?",
  "one": "one",
  "three": "three",
  "two": "two"
}

Contents of intl_fr.arb:

{
  "@@locale": "fr",
  "hello": "Salut {name}!",
  "@hello": {
    "placeholders": {
      "name": {
        "type": "String"
      }
    }
  },
  "howDoYouDo": "Comment ça va?",
  "one": "un",
  "three": "trois",
  "two": "deux"
}
2
likes
160
points
23
downloads

Publisher

verified publisherabcx3.com

Weekly Downloads

A command-line tool to merge ARB files from multiple sources based on the files' locale.

Homepage
Repository (GitHub)

Topics

#tools #arb #i18n #merge

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

args, logging, path, yaml

More

Packages that depend on arb_merge