Last active
September 23, 2022 21:46
-
-
Save mondeja/3cbcaee52345775f434d4208d571e76e to your computer and use it in GitHub Desktop.
txt2po
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
#!/bin/sh | |
output="" | |
while read line; do | |
if [ -z "$line" ]; then | |
continue | |
fi; | |
escaped_line=$(echo $line | sed -e 's/"/\\"/g') | |
new_line="msgid \"$escaped_line\"\nmsgstr \"\"" | |
if [ -n "$output" ]; then | |
output="${output}\n\n${new_line}" | |
else | |
output="${output}${new_line}" | |
fi; | |
done < $1 | |
echo "$output" > $2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment