Coder Social home page Coder Social logo

Comments (11)

izimobil avatar izimobil commented on July 17, 2024

Original comment by qx0monster (Bitbucket: qx0monster, GitHub: Unknown):


Sorry, I'm out of this. I will not be able to provide a patch as discussed, so please don't wait for me. Close or proceed as you see fit.

from polib.

izimobil avatar izimobil commented on July 17, 2024

Original comment by qx0monster (Bitbucket: qx0monster, GitHub: Unknown):


I'm terribly lagging behind ...

from polib.

izimobil avatar izimobil commented on July 17, 2024

Original comment by David Jean Louis (Bitbucket: izi, GitHub: izi):


Issue #35 was marked as a duplicate of this issue.

from polib.

izimobil avatar izimobil commented on July 17, 2024

Original comment by David Jean Louis (Bitbucket: izi, GitHub: izi):


Hi qx0monster, any progress on this ? Thanks.

from polib.

izimobil avatar izimobil commented on July 17, 2024

Original comment by Jakub Wilk (Bitbucket: jwilk, GitHub: jwilk):


The correct solution is to fix the parser to decode all escape sequences (and possibly signal an error on unknown ones).

AFAICS it is true that with qx0monster's patch polib indeed round-trips properly. It's just the Python objects that are supposed to represent the PO file contents don't make sense. For example, for this file:

msgid ""
msgstr ""

msgid "\\n"
msgstr ""

I get:

>>> polib.pofile('t.po')[0].msgid[-1].isspace()
True

which is wrong: the msgid didn't contain any whitespace.

from polib.

izimobil avatar izimobil commented on July 17, 2024

Original comment by David Jean Louis (Bitbucket: izi, GitHub: izi):


It would be cool if you could send a pull request (with tests and docs), thanks in advance !

from polib.

izimobil avatar izimobil commented on July 17, 2024

Original comment by qx0monster (Bitbucket: qx0monster, GitHub: Unknown):


Would you suggest I'll take a look at it? Or is this something you want to do yourself?

from polib.

izimobil avatar izimobil commented on July 17, 2024

Original comment by David Jean Louis (Bitbucket: izi, GitHub: izi):


I think this should be done in polib.pofile and polib.mofile, but also in polib.POFile and polib.MOFile classes, as it's done for the check_for_duplicates option.

from polib.

izimobil avatar izimobil commented on July 17, 2024

Original comment by qx0monster (Bitbucket: qx0monster, GitHub: Unknown):


Fine with me. Where would this option be set? On the POFile/_BaseFile object? Will you add it to the params of the pofile() factory?

from polib.

izimobil avatar izimobil commented on July 17, 2024

Original comment by David Jean Louis (Bitbucket: izi, GitHub: izi):


Hi, thanks for the explanations, it makes perfect sense indeed. That said, doing this by default will totally break backwards compatibility, so I'm +1 on this if it's an explicit option.
Regards.

from polib.

izimobil avatar izimobil commented on July 17, 2024

Original comment by qx0monster (Bitbucket: qx0monster, GitHub: Unknown):


To add a bit more rational to this issue:

  • Compatibility with gettext tools: The gettext parser supports (a) octal numbers of the form '\ooo', (b) hex numbers of the form '\x...' and (c) some additional control seq's like '\b', '\f', '\v' and '\a' (while most of the latter are warned about as "not suitable" for internationalization efforts).
  • The gettext parser is strict, in that it does not allow unknown escape sequences (it bombs). It also seems to replace escape sequences with their binary equivalent, e.g. '\x61' is replaced with 'a'. Leaving octal, hex and the other allowed control seq's untouched seems like a good interop measure, for people using both polib and gettext tools.
  • Unicode support: gettext tools don't support unicode escapes (Funnily, there is a code comment in po-lex.c, saying "FIXME: \u and \U are not handled"! http://git.savannah.gnu.org/cgit/gettext.git/tree/gettext-tools/src/po-lex.c?id=b75a50bc5f30666fb36469a90245e1d7856d672c#n851). But as I said support for unicode escapes is crucial for us, and I would appreciate if polib was getting ahead of gettext in this respect. Being just lenient with unknown escape seq's would do the job.

from polib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.