GithubHelp home page GithubHelp logo

Comments (7)

adrai avatar adrai commented on May 28, 2024

Can you share a bit more information?
How does the directory structure look like?
Some sample files... before and after...
arguments used in sync command... cli output... etc...

from locize-cli.

michael-mao avatar michael-mao commented on May 28, 2024

Thanks for the response, I will try to list out the exact workflow we're using below.

We extract strings to JSON files in a locales/ directory where the filename is the namespace we use in Locize, for example:

locales/
  en-US/
    test.json
  fr-FR/
    test.json

The JSON files would look something like below with keys mapped to empty string

{
  "Accepted": "",
  // more keys 
}

At this point we already have a translation on Locize for the "Accepted" key and just want to add new keys that have been tagged in the codebase.

We try to sync to Locize using the CLI

$ locize sync --api-key <api_key> --project-id <project_id> --format json --namespace test --path locales --reference-language-only false

output:

adding 59 keys in en-US/test...
removing 1 keys in fr-FR/test...
adding 58 keys in fr-FR/test...
syncing...
FINISHED

The result is that new keys are added but the translation we already had for the existing "Accepted" key on Locize is overwritten.

from locize-cli.

adrai avatar adrai commented on May 28, 2024

Ahh ok, I understand.
This is the expected behaviour. The sync command will synchronize locize with what you have locally. Your local directory is the master.

What you are looking for is something like a saveMissing feature via cli... right?
i.e. Just add new keys found via the i18next-scanner and not update and not delete anything, right?

from locize-cli.

adrai avatar adrai commented on May 28, 2024

For your use-case we just released a new cli version with a new command: save-missing
https://github.com/locize/locize-cli#push-missing-keys-to-locize-from-your-repository-or-any-other-local-directory

locize save-missing --api-key <api_key> --project-id <project_id> --format json --namespace test --path locales --reference-language-only false

from locize-cli.

adrai avatar adrai commented on May 28, 2024

I hope this is what you was looking for

from locize-cli.

michael-mao avatar michael-mao commented on May 28, 2024

That's great, thank you @adrai ! The save-missing functionality is what we're looking for

from locize-cli.

adrai avatar adrai commented on May 28, 2024

btw to preserve empty strings you may enable this option in your project’s settings:

from locize-cli.

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.