Multi line strings for plural messages in PO files lead to syntax error
Closed this issue · 3 comments
erictapen commented
Hi, I just stumbled over this problem, where multi line strings don't work in plural messages.
Multi line strings in singular messages as well as single line strings in plural messages work very much fine:
msgid "a"
msgstr "This is a"
"multi line string"
msgid "b"
msgid_plural "b_plural"
msgstr[0] "single line"
msgstr[1] "single line"
iex(7)> Expo.PO.parse_file!("good.po")
%Expo.Messages{
headers: [],
messages: [
#Expo.Message.Singular<
msgid: ["One participation request for event %{title} to process"],
msgstr: ["a", "a"],
msgctxt: nil,
comments: [],
extracted_comments: [],
flags: [],
previous_messages: [],
references: [],
obsolete: false,
...
>,
#Expo.Message.Plural<
msgid: ["One participation request for event %{title} to process"],
msgid_plural: ["One participation request for event %{title} to process"],
msgstr: %{0 => ["a"], 1 => ["a"]},
msgctxt: nil,
comments: [],
extracted_comments: [],
flags: [],
previous_messages: [],
references: [],
obsolete: false,
...
>
],
top_comments: [],
file: "good.po"
}
But the combination of plural message and multi line string does not:
msgid "a"
msgid_plural "a_plural"
msgstr[0] "single line"
msgstr[1] "This is a"
"multi line string"
iex(8)> Expo.PO.parse_file!("bad.po")
** (Expo.PO.SyntaxError) bad.po:5: syntax error before: "multi line string"
(expo 0.4.0) lib/expo/po.ex:171: Expo.PO.parse_file!/2
iex:8: (file)
But from my understanding, both files should be valid .po files? Plus the necessary headers ofc.
I already tried to look into the parsing logic, but realised that Elixir is still pretty new to me.
whatyouhide commented
@maennchen any chance you got some time to look into this? 🙃
whatyouhide commented
Thanks @maennchen! @erictapen I released v0.4.1.