You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Example: parsing this basic file generated with xgettext with default options
Notice that it doesn't contains Plural-Forms
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-09 17:34+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: main.cpp:28
msgid "item"
msgstr ""
And parsing this files with polib::po_file::parse will panics with
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polib-0.2.0/src/metadata.rs:81:84
It should use unwrap_or_default or something like that instead
Ideally, the MetaData should also keep the metadata as is so i can add messages to a .pot file without changing most metadata.
The text was updated successfully, but these errors were encountered:
Thank you for reporting the issue. When I wrote the library I was assuming input data is a .po file of translation data for a particular language, so Plural-Forms is always present in the metadata. Some code changes in polib is necessary to accommodate .pot files.
Metadata::parse panics if some metadata header is not present because it unwraps the result of get()
polib/src/metadata.rs
Lines 69 to 81 in a1b9b57
Example: parsing this basic file generated with xgettext with default options
Notice that it doesn't contains
Plural-Forms
And parsing this files with
polib::po_file::parse
will panics withIt should use unwrap_or_default or something like that instead
Ideally, the MetaData should also keep the metadata as is so i can add messages to a .pot file without changing most metadata.
The text was updated successfully, but these errors were encountered: