question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Passing options to `GettextParser.po` compiler in `i18nextToGettext`

See original GitHub issue

Hello, everyone, sorry if this issue was created somewhere, I tried to searching through the list but did not find anything relevant.

The problem I’ve encountered is that when I’m trying to parse json -> po I get the following output of po file:

msgid "Accept offer note"
msgstr ""
"Jetzt bräuchten wir noch ein paar Informationen von Ihnen um die Bestellung "
"abzuschliessen."

whereas expected output would be:

msgid "Accept offer note"
msgstr "Jetzt bräuchten wir noch ein paar Informationen von Ihnen um die Bestellung abzuschliessen."

I’ve dug deep into the library and found out that pocompiler which is used by gettext-parser has a default of 76 foldLength of a string, that’s why you get such result.

It seems that when i18nextToGettext passes the data into parser.compile it is not possible to pass any options for the compiler itself, which imo would be awesome to have! Or at least default foldLength to 0 (disable) because this is, imho, is an opinionated feature.

Or maybe there’s a workaround? Because right now we have a bunch of translation keys which are longer than 76 chars and our translation service does not accept “invalid” po files

Could someone clarify if it’s an issue at all?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mvirbicianskascommented, Feb 1, 2019

I see, it’s all very good that it is in the spec (sorry if I came on wrong footing! I’m just not very familiar with the spec), but it would be more awesome to be able to pass options to the parser as well, it’s not even a breaking change, just an optional feature 😉

0reactions
perrin4869commented, Feb 1, 2019

That’s it, that’s all there is to it 😉

On Fri, Feb 1, 2019, 4:06 PM mvirbicianskas <notifications@github.com wrote:

Fantastic! But I’ve never contributed to open source projects yet, I’d be glad to do that, are there any guidelines I should follow? Or just fork it, create upstream, do some changes, push and PR?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/i18next/i18next-gettext-converter/issues/81#issuecomment-459627981, or mute the thread https://github.com/notifications/unsubscribe-auth/AFgdfLnvri4gFH-kb-qsFNi5YBExJVvpks5vI-dygaJpZM4acYOX .

Read more comments on GitHub >

github_iconTop Results From Across the Web

gettext-parser - npm
Parse and compile gettext po and mo files to/from json, ... Start using gettext-parser in your project by running `npm i gettext-parser`.
Read more >
GNU gettext utilities
How to pass such an option to xgettext , assuming that gettextize is used, is described in Makevars in po/ and AM_XGETTEXT_OPTION in...
Read more >
How to use the gettext-parser.mo function in gettext-parser
To help you get started, we've selected a few gettext-parser examples, based on popular ways it is used in public projects. Secure your...
Read more >
gettext — Multilingual internationalization services — Python ...
Source code: Lib/gettext.py The gettext module provides internationalization (I18N) and localization (L10N) services for your Python modules and ...
Read more >
gettext - Go Packages
func NewParser(options ...Option) *Parser. func (p *Parser) Parse(data []byte) (*Po, error); func (p *Parser) ParseFile(f string) (*Po, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found