Comments (5)
Hmm, yeah. Well, I just merged #84 which allows people using the module to push in g2m options that would fix the replacements or set them however they like. It won't help the command line users, but at least it's something.
At some point, I just need to bite the bullet, move one major version up, and re-write this thing in modern JS, probably even TS, and toss out the old weird stuff that changing right now will break for a ton of folks. Someday...
from po2json.
Hey @maximelebastard! Thanks for the bug report—this project lives and dies by the very specific issues our users find.
Not to kick you further upstream, but it looks like the original problem comes from gettext-to-messageformat. It's a great module that goes a lot further in effectively converting po files to mf than we were doing originally pre 1.0, but it does appear to be the source of your braces escaping issue.
Nevertheless, I have a PR up on this repo that addresses your issue directly by un-escaping the braces in the most brute-force way possible. Take a peek at #78 and see if that solves your problem. If it seems like it fixes things for you, great! It may be a decent stopgap until g2m resolves this, if that project feels it needs to.
from po2json.
Hey @mikeedwards,
It seems that you can manage the replacements through the options in gettext-to-messageformat parsePo function:
See: https://github.com/messageformat/gettext-to-messageformat/blob/master/index.js
The first replacement causes the above issue I think. Is there a way to expose this option or to disable the first replacement by default?
from po2json.
Hmm, that does look promising. My main concern would be if there are any unintended consequences in removing that escaping. Is this a problem that you're running into with your own projects? Would you mind testing a branch if I make one that fixes this by changing the g2m defaults? The big trick with making updates to po2json is that people have many different languages, uses etc. that I'm not always able to cover in the tests beforehand, so I like to check in with folks using it in the real world for updates like this.
from po2json.
@mikeedwards That is a valid concern. If implemented this way, this would mean a breaking change.
The alternative is to optionally expose that option in some form in the po2json options and let de default behaviour be like it is now.
Our frontend implementations use ngx-translate (https://github.com/ngx-translate/core).
They use variable injection with the {...}
placeholder. Using po2json breaks the variable injection.
from po2json.
Related Issues (20)
- A new stable version needed! HOT 3
- Invalid 'main' key HOT 4
- Invalid 'main' field in Node 16 HOT 1
- Fuzzy entries are ignored HOT 1
- Headers are output in inconsistent order HOT 1
- Error converting some files
- Using msgctxt HOT 8
- PO AJAX response 2 JSON? HOT 1
- Jed converting error HOT 4
- fuzzy and comments in po disappear on json. HOT 3
- Why is null added as the first entry in the translations? HOT 10
- Licensing issues HOT 4
- Version 1 alpha taged as latest in NPM breaks stuff HOT 2
- .po -> Module parse failed HOT 1
- Invalid executable file `bin/po2json` which bundled npm package HOT 2
- npm WARN deprecated [email protected] HOT 2
- About dependencies in package.json HOT 4
- Different output in some languages when there is semicolon in header HOT 1
- `mf` format can't handle plurals HOT 4
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 po2json.