Giter Club home page Giter Club logo

Comments (12)

leolabs avatar leolabs commented on September 13, 2024 3

I've released a new version that supports ICU as well as i18next and sprintf-style interpolations. You can select the interpolation matcher using the -m flag (e.g. -m i18next in your case). I'd be happy to hear if this works for you :)

from json-autotranslate.

djensen47 avatar djensen47 commented on September 13, 2024

Turns out that if I change {{ to { then it works.

from json-autotranslate.

djensen47 avatar djensen47 commented on September 13, 2024

However, I get the same issue if I'm using i18next nesting $t(key) or $t({{keyInTheVar}})

I'm going to guess this will also fail ${$displayName}

from json-autotranslate.

leolabs avatar leolabs commented on September 13, 2024

Hey @djensen47, thanks for the issue!

Could you provide a sample JSON file and the command you used to run json-autotranslate, so I can try to reproduce it on my side? My guess is that the ICU-format parser doesn't like i18next's syntax. I could add a flag to switch between ICU-style and i18next-style interpolation.

from json-autotranslate.

djensen47 avatar djensen47 commented on September 13, 2024

My translation file is huge so I just included the keys with problems and two that should work just fine.

Note: I don't use the $t(key) syntax but I do use the $t({{keyInTheVar}}) syntax. But you should definitely handle both.

{
  "errorMessages": {
    "formErrors": "Please fix the errors in the form and try again.",
    "invalid-login": "Invalid email address or password",
    "number": "${$displayName} must be a number"
  },
  "message": {
    "confirm-delete-instruction": "Are you sure you want to delete the instruction, \"{{name}}\"?"
  },
  "label": {
    "pricePerUnit": "Price per $t({{unitKey}})"
  }
}

Thanks for fixing this!

from json-autotranslate.

djensen47 avatar djensen47 commented on September 13, 2024

For some reason npm install isn't working after the update. Not sure if it's "just me" yet or not.

from json-autotranslate.

leolabs avatar leolabs commented on September 13, 2024

Hmm, that's weird. I'll check it on my side as well. Can you provide the npm error you get when you try to run json-autotranslate?

from json-autotranslate.

djensen47 avatar djensen47 commented on September 13, 2024
$ npm i -S json-autotranslate

npm ERR! path /src/node_modules/json-autotranslate/lib/index.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/src/node_modules/json-autotranslate/lib/index.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

from json-autotranslate.

djensen47 avatar djensen47 commented on September 13, 2024

I'm running node 8.14.0 but it also happens on 6.

I confirmed that the problem is happening on two different machines.

from json-autotranslate.

djensen47 avatar djensen47 commented on September 13, 2024

After I use yarn to install, there's a similar issue. Under node_modules/json-autotranslate there are no source files.

It's like the last push to npm and yarn didn't succeed?

from json-autotranslate.

leolabs avatar leolabs commented on September 13, 2024

You were right. The build somehow failed on GitHub Actions. I've fixed that and everything should work as expected again.

from json-autotranslate.

djensen47 avatar djensen47 commented on September 13, 2024

Works great now. Thanks!

from json-autotranslate.

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.