arb_glue 0.0.2 copy "arb_glue: ^0.0.2" to clipboard
arb_glue: ^0.0.2 copied to clipboard

ARB Glue is a tool that merges multiple files into one single [ARB] format file, facilitating the management of internationalization resources.

ARB Glue #

ARB Glue is a tool that merges multiple files into one single ARB format file, facilitating the management of internationalization resources.

Usage #

Original Structure:

.
└── lib/
    └── l10n/
        ├── en/
        │   ├── global.yaml
        │   └── feature-1.yaml
        └── zh/
            ├── global.yaml
            └── feature-1.yaml

Execution:

dart run arb_glue
# or
flutter pub run arb_glue

Resulting structure:

.
└── lib/
    └── l10n/
        ├── en/
        │   ├── global.yaml
        │   └── feature-1.yaml
        ├── zh/
        │   ├── global.yaml
        │   └── feature-1.yaml
        ├── en.arb
        └── zh.arb

Supported formats #

Currently, ARB Glue supports JSON and YAML encoded files.

In addition to ARB format, it allows writing descriptions directly into one key:

{
  "myButton": "My Button {type}",
  "@myButton": {
    "description": "My custom button label",
    "placeholders": {
      "type": {"type": "String"}
    }
  }
}

This is equivalent to:

myButton:
  text: My Button
  description: My custom button label
  placeholders:
    type: {type: String}

And equal to:

myButton:
- My Button
- My custom button label # description and placeholders can switch lines
- type: {type: String}

Context #

Each file can have its own prefix by setting @@context:

"@@context": "myFeature"
button: "My Feature Button"

This will render:

{
  "myFeatureButton": "My Feature Button"
}

Configuration #

There are two methods to configure the process: via pubspec.yaml or through command-line arguments.

pubspec.yaml:

# pubspec.yaml
name: MyApp
arb_glue:
  source: lib/l10n

Command line:

dart run arb_glue --source lib/l10n

Full configuration options:

arb_glue:
  # The source folder contains the files.
  # Type: String
  source: lib/l10n
  # The destination folder where the files will be generated.
  # Type: String
  destination: lib/l10n
  # Blacklisted folders inside the [source].
  # Type: List<String>
  exclude:
  # The author of the arb file.
  # Type: String
  author:
  # The context of the arb file.
  # Type: String
  context:
  # The base locale of the arb file.
  # If not provided, the base locale will be the first locale found in the
  # source folder.
  # Type: String
  base:
  # Whether to print verbose output.
  # Type: bool
  verbose: false
3
likes
0
points
104
downloads

Publisher

unverified uploader

Weekly Downloads

ARB Glue is a tool that merges multiple files into one single [ARB] format file, facilitating the management of internationalization resources.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

args, path, yaml

More

Packages that depend on arb_glue