Closed Truemedia closed 4 years ago
Found a workaround for this, on line 71 inside the main function, by swapping
messages[item.msgctxt] = value;
With:
messages[item.msgctxt != undefined ? item.msgctxt : item.msgid] = value;
Thoughts? Would this be worth a pull request as could do with this change to at least have basic string to string translations
Hi @Truemedia , msgctxt is always expected to exists, this can be seen in the test data, e.g. https://github.com/avast/vuei18n-po/blob/master/spec/data/en.po
However, based on your inquiry, I have found some use cases where msgctxt can be omitted.
I'm not sure without a deeper look whether making msgctxt optional can be done just by the single line change. Does it work for you?
@pavelstudeny Yes that single line change works for me I made the change directly in the node_modules and worked for me. I will try the sample you provided but yeh just thinking to cover edge cases
@pavelstudeny Yeh the sample works for me, however still get this issue in a newer scenario where I'm using a gettext-extractor to generate a POT file from sources, then using the POT file to update PO files. Still get the original issue in that scenario unless I put the work around in
@Truemedia https://github.com/avast/vuei18n-po/commit/7419a00f9422b659269ed38a81bd162441785585 should work. Filtering (if used) should still go just by msgctxt, I believe. Agreed?
@pavelstudeny Thanks, yeh looks about right I'll give a try.
fixed in 1.2.0
Hi, I think this package is a great idea and would be massively useful for me as Vue and vue-i18n are must for me and don't like the idea of translations in a JSON file.
Iv'e yet to get this working though, using a sample PO file I took from online I either only get the first message in the generate.json will the key being null or an empty object.
Any change this could be provided or is this project still a work in progress?