Comments (11)
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.
Original comment by qx0monster (Bitbucket: qx0monster, GitHub: Unknown):
I'm terribly lagging behind ...
from polib.
Original comment by David Jean Louis (Bitbucket: izi, GitHub: izi):
Issue #35 was marked as a duplicate of this issue.
from polib.
Original comment by David Jean Louis (Bitbucket: izi, GitHub: izi):
Hi qx0monster, any progress on this ? Thanks.
from polib.
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.
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.
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.
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.
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.
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.
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)
- homepage link and description is outdated HOT 3
- Allow more control comparing PO entries
- Cannot get metadata from existing po HOT 4
- OSError: Syntax error in po file (line 1) HOT 1
- [BUG] parser doesn't close file when an IOError error is raising HOT 1
- How to read mo file content and convert to pofile contents HOT 1
- Add support for pathlib HOT 4
- 1.1.1: pytest is failing in `tests/tests.py::TestFunctions::test_is_file` unit HOT 4
- fuzzy count contains obsolete fuzzy messages
- (Un)escape more characters HOT 1
- (faulty issue)
- _BaseEntry/POEntry constructors have bad signatures HOT 1
- New release?
- Drop py<=3.6 and clean up/modernize the code?
- Trying to open a non-existant .po file gives incorrect error HOT 3
- sdist is missing tox.ini
- List of occurrences wrapped differently than xgettext
- "OSError: Syntac Error" when file not found HOT 2
- How to wrap the "msgstr" with the specified width? HOT 2
- [question] How to get same behaviour of po4a in wrap? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from polib.