mix gettext_ops.change_msgid (gettext_ops v0.1.1)
View SourceUpdate msgid (source text) across all .po and .pot files.
This command updates the msgid field in all translation files while preserving all existing translations (msgstr values remain intact). It's useful for fixing typos, improving wording, or standardizing terminology in your source strings.
Usage
mix gettext_ops.change_msgid OLD_MSGID NEW_MSGID [options]What It Does
- Finds all .po files in priv/gettext/*/LC_MESSAGES/ for the specified domain
- Finds the .pot template file for the specified domain
- Updates the msgid in all matching entries
- Preserves all translations (msgstr values remain intact)
- Shows summary of changes
Arguments
OLD_MSGID- The current msgid to find and replaceNEW_MSGID- The new msgid to use
Options
--dry-run- Preview changes without modifying files--domain/-d- Gettext domain (defaults to configured default_domain)
Examples
# Update msgid everywhere
mix gettext_ops.change_msgid "Sign In" "Log In"
# Preview changes first (recommended)
mix gettext_ops.change_msgid --dry-run "Sign In" "Log In"
# Specific domain
mix gettext_ops.change_msgid "Error" "Warning" --domain errorsDry Run Output Example
Would update the following files:
✓ priv/gettext/sv/LC_MESSAGES/default.po (1 entry)
msgid "Sign In" → "Log In"
msgstr "Logga in" (preserved)
✓ priv/gettext/en/LC_MESSAGES/default.po (1 entry)
msgid "Sign In" → "Log In"
msgstr "" (preserved)
✓ priv/gettext/default.pot (1 entry)
msgid "Sign In" → "Log In"
Would update 3 file(s) with 3 total entriesActual Update Output
Updated the following files:
✓ priv/gettext/sv/LC_MESSAGES/default.po (1 entry)
✓ priv/gettext/en/LC_MESSAGES/default.po (1 entry)
✓ priv/gettext/default.pot (1 entry)
Updated 3 file(s) with 3 total entriesSafety Features
- Atomic updates: Files are written atomically to prevent corruption
- Dry run mode: Always preview changes with
--dry-runbefore applying - Preserves translations: All msgstr values remain unchanged
- Preserves metadata: Comments, references, and flags are retained
Important Notes
- This command does NOT update source code references
- After changing msgid, you may need to update your source code separately
- Use
--dry-runfirst to verify which files will be affected - All translations (msgstr) are preserved automatically