Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing msgctxt lines without quotes #4

Closed
wants to merge 1 commit into from
Closed

Allowing msgctxt lines without quotes #4

wants to merge 1 commit into from

Conversation

MpDzik
Copy link

@MpDzik MpDzik commented Nov 11, 2013

No description provided.

@mlocati
Copy link
Owner

mlocati commented Nov 12, 2013

Thank you for sharing, @MpDzik
Just a question: why are you willing to handle msgctxs without double quotes?
IMHO they are required by the gettext specs (for instance, the .po/.pot files created by xgettext do contain double quotes...)

@MpDzik
Copy link
Author

MpDzik commented Nov 12, 2013

Hi, I was working on PO localization files using for Orchard CMS using the Better PO Editor. All the PO files had msgctx without double quotes and I was unable to use the editor since I could not open any PO file. I don't know if the standard requires the quotes but maybe it would be a good idea to also parse PO files without quotes.

Maybe I could add a setting to the options dialog so this behavior can be enabled only for some users?

@mlocati
Copy link
Owner

mlocati commented Nov 12, 2013

I downloaded the Italian .po files and in the few .po files that I tested I can see that contexts have double quotes... For instance:

msgctxt "~/Modules/Bing.Maps/Module.txt"
msgid "Bing.Maps"
msgstr "Bing.Maps"

Nevertheless BetterPOEditor is not able to open those files, and I'm going to investigate this.

Which language are you working on? Can you provide me the link one of the .po files with msgctxt that don't have double quotes?

@MpDzik
Copy link
Author

MpDzik commented Nov 12, 2013

Polish language. Below is a sample file:

#: ~/Modules/Libreo.Reports/Module.txt
#. "Name"
msgctxt ~/Modules/Libreo.Reports/Module.txt
msgid "Libreo Reports"
msgstr "Libreo Reports"

#: ~/Modules/Libreo.Reports/Module.txt
#. "Author"
msgctxt ~/Modules/Libreo.Reports/Module.txt
msgid "Przemek Godlewski / Libreo"
msgstr "Przemek Godlewski / Libreo"

#: ~/Modules/Libreo.Reports/Module.txt
#. "Website"
msgctxt ~/Modules/Libreo.Reports/Module.txt
msgid "http://www.libreo.pl"
msgstr "http://www.libreo.pl"

#: ~/Modules/Libreo.Reports/Module.txt
#. "Description"
msgctxt ~/Modules/Libreo.Reports/Module.txt
msgid "Provides reports feature for Libreo management application."
msgstr "Provides reports feature for Libreo management application."

#: ~/Modules/Libreo.Reports/Module.txt
#. "Libreo.Reports.Description"
msgctxt ~/Modules/Libreo.Reports/Module.txt
msgid "Description for feature Libreo.Reports."
msgstr "Description for feature Libreo.Reports."

#: Libreo.Reports.Controllers.ReportsController
#. "Error occur on report preparation. Please try again."
msgctxt Libreo.Reports.Controllers.ReportsController
msgid "Error occur on report preparation. Please try again."
msgstr "Wystąpił błąd w trakcie przygotowywania raportu. Proszę spróbować ponownie."

#: Libreo.Reports.Controllers.ReportsController
msgctxt Libreo.Reports.Controllers.ReportsController
msgid "Error occur on report preparation. Data access denied."
msgstr "Wystąpił błąd w trakcie przygotowywania raportu. Brak dostępu do danych."

#: Libreo.Reports.Controllers.ReportsController
msgctxt Libreo.Reports.Controllers.ReportsController
msgid "Error occur on report preparation. Parameters verification error."
msgstr "Wystąpił błąd w trakcie przygotowywania raportu. Podane parametry są nieprawidłowe."

#: Libreo.Reports.Controllers.ReportsController
msgctxt Libreo.Reports.Controllers.ReportsController
msgid "Error occur on report preparation. Backend error or parameters set is incorrect."
msgstr "Wystąpił błąd w trakcie przygotowywania raportu. Błąd wewnętrzny lub niepoprawne parametery."

#: Libreo.Reports.Controllers.ReportsController
msgctxt Libreo.Reports.Controllers.ReportsController
msgid "There are no data to show."
msgstr "Brak danych do wyświetlenia."

#: Libreo.Reports.Controllers.ReportsController
msgctxt Libreo.Reports.Controllers.ReportsController
msgid "Error occur on report preparation. Conversion error."
msgstr "Wystąpił błąd w trakcie przygotowywania raportu. Błąd konwersji danych."

#: ~/Modules/Libreo.Reports/Views/Parts/Widget.ReportsLinks.cshtml
msgctxt ~/Modules/Libreo.Reports/Views/Parts/Widget.ReportsLinks.cshtml
msgid "Reports"
msgstr "Raporty"

#: ~/Modules/Libreo.Reports/Views/Reports/Index.cshtml
msgctxt ~/Modules/Libreo.Reports/Views/Reports/Index.cshtml
msgid "Reports"
msgstr "Raporty"

#: ~/Modules/Libreo.Reports/Views/Reports/ReportParameters.cshtml
msgctxt ~/Modules/Libreo.Reports/Views/Reports/ReportParameters.cshtml
msgid "Generate"
msgstr "Generuj"

@mlocati
Copy link
Owner

mlocati commented Nov 12, 2013

In which file is this text in? I downloaded the file from http://www.orchardproject.net/localize/download/pl-PL but there is a ton of .po files...

@MpDzik
Copy link
Author

MpDzik commented Nov 12, 2013

The file is named orchard.module.po. It's encoded in UTF-8 without BOM. It's not published with the Orchard repository, because I'm working on a private project based on Orchard.

I shared the file on my SkyDrive:
https://skydrive.live.com/redir?resid=64BB3CCDE0EAB288!3129&authkey=!AApmsMerWXjmaBQ

@mlocati
Copy link
Owner

mlocati commented Nov 12, 2013

It seems that msgfmt needs double quotes around msgctxs:

$ msgfmt orchard.module.po
orchard.module.po:3:10: syntax error
orchard.module.po:3: keyword "Modules" unknown
orchard.module.po:10:10: syntax error
orchard.module.po:10: keyword "Modules" unknown
orchard.module.po:17:10: syntax error
orchard.module.po:17: keyword "Modules" unknown
orchard.module.po:24:10: syntax error
orchard.module.po:24: keyword "Modules" unknown
orchard.module.po:31:10: syntax error
orchard.module.po:31: keyword "Modules" unknown
orchard.module.po:39: keyword "Libreo" unknown
orchard.module.po:39:15: syntax error
orchard.module.po:45: keyword "Libreo" unknown
orchard.module.po:45:15: syntax error
orchard.module.po:51: keyword "Libreo" unknown
orchard.module.po:51:15: syntax error
orchard.module.po:57: keyword "Libreo" unknown
orchard.module.po:57:15: syntax error
orchard.module.po:63: keyword "Libreo" unknown
orchard.module.po:63:15: syntax error
msgfmt: too many errors, aborting

I added double quotes around msgctxs and the compilation was successful:

$ msgfmt orchard.module-msgctx-with-quotes.po
(no errors)

IMHO you should fix the procedure that is used to generate this .po file...

I'm going to close this pull request because BetterPOEditor is not meant to work with broken .po fils, but I'm going to open an issue because it can't open official Orchard .po files (that have double-quotes in msgctxs)...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants