Comments (7)
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.
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.
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.
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.
I hope this is what you was looking for
from locize-cli.
That's great, thank you @adrai ! The save-missing functionality is what we're looking for
from locize-cli.
btw to preserve empty strings you may enable this option in your project’s settings:
from locize-cli.
Related Issues (20)
- version contains strange undeletable namespaces HOT 1
- Mapping between CLI params and config options HOT 1
- Locize sync results in FetchError HOT 5
- TypeError: Cannot read properties of null (reading 'value') HOT 1
- install.ps1 automatic figuring out of download url version has broken HOT 2
- bug(install): binary install not working HOT 15
- Not downloading all translations HOT 2
- The sync command crashes with Error: Callback was already called HOT 1
- The download command fails with an error when using the android format HOT 4
- vulnerabilities on npm install HOT 2
- `locize format` removes comments from `fluent files` HOT 1
- Fluent's `Message References` is not being saved in Locize. HOT 1
- High severity vulnerabilities on npm install HOT 1
- Locize-cli timeouts on sync HOT 4
- Support overwriting HOT 4
- https-proxy-agent dependency error on fresh install HOT 1
- Sync command doesn't do what documentation says HOT 4
- Download command misses newly added namespaces for tenant projects HOT 3
- 2 high severity vulnerabilities in xlsx HOT 2
- doesn't read variables from .locize? HOT 2
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 locize-cli.