Translating .PO, .XLIFF, and .ARB Files Programmatically
How to parse, extract translatable segments, translate via API, and write back .PO, .XLIFF, and .ARB files with metadata intact.
Most localization workflows revolve around file formats: .po for gettext-based projects, .xliff for Apple and enterprise tools, .arb for Flutter/Dart. If you want to automate translation, you need to parse these files, extract the translatable strings, send them through a translation API, and write the results back without breaking metadata or structure.
Here's how to handle each format.
.PO files (gettext)
PO (Portable Object) files are the standard for C, Python, PHP, Ruby, and many other ecosystems. They have a simple text-based format: