Skip to content

Latest commit

Β 

History

History
92 lines (75 loc) Β· 1.78 KB

File metadata and controls

92 lines (75 loc) Β· 1.78 KB

Providing Output

πŸ’‘ Tip: input as directory, output as file won't work! ❌

Let's say we have a folder tree like this:

.
└── locale/
    β”œβ”€β”€ a.po
    β”œβ”€β”€ b.po
    └── c.po

We can specify the output path with the --output (or -o alias) option.

By providing the output to a filename a-converted.mo:

po2mo ./locale/a.po --output ./locale/a-converted.mo

We can set the output filename as well:

.
└── locale/
    β”œβ”€β”€ a.po
    β”œβ”€β”€ a-converted.mo <-- new!
    β”œβ”€β”€ b.po
    └── c.po

What if we want the outputs to be in the output directory?

po2mo ./locale --output ./output

This will ensure the converted .mo files stored in the output directory:

.
β”œβ”€β”€ locale/
β”‚   β”œβ”€β”€ a.po
β”‚   β”œβ”€β”€ b.po
β”‚   └── c.po
└── output/  <-- new!
    β”œβ”€β”€ a.mo <-- new!
    β”œβ”€β”€ b.mo <-- new!
    └── c.mo <-- new!

What about the --recursive option for the nested folders?

.
└── locale/
    β”œβ”€β”€ nested/
    β”‚   β”œβ”€β”€ aa.po
    β”‚   β”œβ”€β”€ bb.po
    β”‚   └── cc.po
    β”œβ”€β”€ a.po
    β”œβ”€β”€ b.po
    └── c.po

No worries, we preserve the folder structure of the nested .po files!

po2mo ./locale --output ./output --recursive
.
β”œβ”€β”€ locale/
β”‚   β”œβ”€β”€ nested/
β”‚   β”‚   β”œβ”€β”€ aa.po
β”‚   β”‚   β”œβ”€β”€ bb.po
β”‚   β”‚   └── cc.po
β”‚   β”œβ”€β”€ a.po
β”‚   β”œβ”€β”€ b.po
β”‚   └── c.po
└── output/       <-- new!
    β”œβ”€β”€ nested/   <-- new!
    β”‚   β”œβ”€β”€ aa.mo <-- new!
    β”‚   β”œβ”€β”€ bb.mo <-- new!
    β”‚   └── cc.mo <-- new!
    β”œβ”€β”€ a.mo      <-- new!
    β”œβ”€β”€ b.mo      <-- new!
    └── c.mo      <-- new!