Created
May 2, 2024 19:09
-
-
Save rixx/9f5e93d8d286f683f0b7efc7edd82961 to your computer and use it in GitHub Desktop.
polib example for gnu gettext pofile editing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pathlib, polib | |
pofiles = list(pathlib.Path(".").glob("**/**/django.po")) | |
defuzzy = ["foo", "bar"] | |
for path in pofiles: | |
po = polib.pofile(path) | |
for msg in defuzzy: | |
entry = po.find(msg) | |
if entry and entry.fuzzy: | |
entry.flags.remove("fuzzy") | |
entry.previous_msgid = None | |
po.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment