nitc :: POFile :: defaultinit
# A GNU gettext .po/.pot file
class POFile
super Writable
# Map of the strings's `msgid` and `msgstr`
#
# Read from a PO file
var strings: Array[PObject]
redef fun write_to_file(path) do
if not path.has_suffix(".po") then path += ".po"
super path
end
redef fun write_to(ofs) do
for i in strings do
ofs.write("#: {i.locations.join(", ")}\n")
ofs.write("msgid \"{i.msgid}\"\n")
ofs.write("msgstr \"{i.msgstr}\"\n\n")
end
ofs.write("# Generated file, do not modify\n")
end
# Writes the information of the POFile to a .pot template file
fun write_template(path: String) do
if not path.has_suffix(".pot") then path += ".pot"
var f = new FileWriter.open(path)
write_to(f)
f.close
end
end
src/frontend/i18n_phase.nit:186,1--216,3