Maybe I have found the solution, it is based on "sed", from its "man" page:
"sed - stream editor for filtering and transforming text"
Look at the second example at the following url, I have tried it (save the last two commands) and it did the job in no time:
https://stackoverflow.com/questions/426 ... c-txt-file
What I did:
Code: Select all
#!/usr/bin/env bash
# - 1 - REMOVE COMMENTS
sed -r -e '/^#/ d' < INPUT.po > OUTPUT.txt
# - 2 - MERGE STRINGS
sed -i OUTPUT.txt -r -e ':L;/"$/{N;s/"\n"//;b L}'
# - 3 - DELETE GETTEXT HEADER
sed -i -e '1,2 d' OUTPUT.txt
What I got:
INPUT FILE (Italian Minetest's .po):
Code: Select all
msgid ""
"Map generation attributes specific to Mapgen v6.\n"
"The 'snowbiomes' flag enables the new 5 biome system.\n"
"When the new biome system is enabled jungles are automatically enabled and\n"
"the 'jungles' flag is ignored.\n"
"Flags that are not specified in the flag string are not modified from the "
"default.\n"
"Flags starting with 'no' are used to explicitly disable them."
msgstr ""
"Attributi di generazione della mappa specifici per Generatore mappa v. 6.\n"
"Quando i biomi di neve sono abilitati le giungle sono abilitate "
"automaticamente, l'impostazione 'jungles' è ignorata.\n"
"Le impostazioni predefinite impostate nel motore sono: biomeblend, mudflow\n"
"La stringa delle impostazioni modifica le impostazioni predefinite del "
"motore.\n"
"Le impostazioni che non sono specificate nella stringa mantengono i valori "
"predefiniti.\n"
"Le impostazioni che iniziano con \"no\" sono usate per disabilitarle "
"esplicitamente."
OUTPUT FILE:
Code: Select all
msgid "Map generation attributes specific to Mapgen v6.\nThe 'snowbiomes' flag enables the new 5 biome system.\nWhen the new biome system is enabled jungles are automatically enabled and\nthe 'jungles' flag is ignored.\nFlags that are not specified in the flag string are not modified from the default.\nFlags starting with 'no' are used to explicitly disable them."
msgstr "Attributi di generazione della mappa specifici per Generatore mappa v. 6.\nQuando i biomi di neve sono abilitati le giungle sono abilitate automaticamente, l'impostazione 'jungles' è ignorata.\nLe impostazioni predefinite impostate nel motore sono: biomeblend, mudflow\nLa stringa delle impostazioni modifica le impostazioni predefinite del motore.\nLe impostazioni che non sono specificate nella stringa mantengono i valori predefiniti.\nLe impostazioni che iniziano con \"no\" sono usate per disabilitarle esplicitamente."
Pretty good, isn't it?
I'll read sed's man page to eventually make it generate "original text=translated text" lines.