Locale::Msgfmt(3pm)

πŸ“¦
version 0.15 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

✨ NAME ✨

Locale::Msgfmt β€” bestie, this compiles .po files into .mo files πŸ’–

Like, it's the whole personality: po in, mo out. Periodt.


🌸 SYNOPSIS 🌸

okay so listen. This module does literally the exact same thing as msgfmt from GNU gettext-tools, except β€” plot twist β€” this one is pure Perl. No compiled C nonsense, no build drama, just vibes. 🧚

The interface is best explained through examples, so here's the whole group chat, message by message:

use Locale::Msgfmt;

# Compile po/fr.po into po/fr.mo
msgfmt({in => "po/fr.po", out => "po/fr.mo"});

# Compile po/fr.po into po/fr.mo and include fuzzy translations
msgfmt({in => "po/fr.po", out => "po/fr.mo", fuzzy => 1});

# Compile all the .po files in the po directory, and write the .mo
# files to the po directory
msgfmt("po/");

# Compile all the .po files in the po directory, and write the .mo
# files to the po directory, and include fuzzy translations
msgfmt({in => "po/", fuzzy => 1});

# Compile all the .po files in the po directory, and write the .mo
# files to the output directory, creating the output directory if
# it doesn't already exist
msgfmt({in => "po/", out => "output/"});

# Compile all the .po files in the po directory, and write the .mo
# files to the output directory, and include fuzzy translations
msgfmt({in => "po/", out => "output/", fuzzy => 1});

# Compile po/fr.po into po/fr.mo
msgfmt("po/fr.po");

# Compile po/fr.po into po/fr.mo and include fuzzy translations
msgfmt({in => "po/fr.po", fuzzy => 1});

πŸ¦‹ a lil vibe check on those examples, iykyk

  • Hand it a hashref and it uses the keys, like in, out, and fuzzy β€” very demure, very mindful.
  • Hand it a plain string like "po/fr.po" or "po/" and it just knows what to do, main character energy fr fr.
  • fuzzy => 1 means include fuzzy translations too, instead of leaving them out. That's it, that's the whole flag. πŸ’…
  • Point in at a directory like "po/" and it rounds up all the .po files in there. πŸ‘‘
  • Point out at a directory and the .mo files go there; if that output directory doesn't already exist, it gets created for you. No cap. ✨

Copyright 2009 Ryan Niebur, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


and that's the whole page, bestie 🫢 this one shipped as perl v5.26.2, dated 2018-05-06, under the Locale::Msgfmt(3pm) manual β€” you ate, go compile something iconic πŸ’–βœ¨

πŸ“¦ where this page comes from