Comments (5)
json-autotranslate expects the locales directory to have one subdirectory per language. So instead of locales/en.default.json
, your source file would need to be located at locales/en/default.json
.
You can then run the tool with yarn json-autotranslate -i locales -s deepl-free -c <your API key>
I hope this helps :)
from json-autotranslate.
The tool should have no issues working with deeply-nested JSON objects, but the error message suggests that the matcher expects variables to be defined as {variable}
in the text. If you define your variables as {{variable}}
, then you might want to switch to i18next's matcher by adding -m i18next
to your command.
I hope this helps :)
from json-autotranslate.
Thanks a ton @leolabs for the clarification! That worked.
I've another problem/question...
My JSON is "heavily" indented...
example:
{
"general": {
"home": "Home",
"accessibility": {
"success": {
"thankYou": "Thank you. Your email was sent",
"commentSubmitted": "Your comment was submitted."
},
"error": "Error:",
"loading": "loading"
},
"meta": {
"tags": "Tags",
"page": "page"
}
},
when I try to run this thru json-autotranslate, I get a:
An error has occurred:
Expected identifier but "{" found.
SyntaxError: Expected identifier but "{" found.
at peg$buildStructuredError (/Users/xxx/Documents/dev/translate/node_modules/messageformat-parser/parser.js:407:12)
at Object.peg$parse [as parse] (/Users/xxx/Documents/dev/translate/node_modules/messageformat-parser/parser.js:1978:11)
at exports.matchIcu (/Users/xxx/Documents/dev/translate/node_modules/json-autotranslate/lib/matchers/icu.js:6:40)
at Object.exports.replaceInterpolations (/Users/xxx/Documents/dev/translate/node_modules/json-autotranslate/lib/matchers/index.js:20:24)
at DeepLFree.<anonymous> (/Users/xxx/Documents/dev/translate/node_modules/json-autotranslate/lib/services/deepl-free.js:119:41)
at step (/Users/xxx/Documents/dev/translate/node_modules/json-autotranslate/lib/services/deepl-free.js:33:23)
at Object.next (/Users/xxx/Documents/dev/translate/node_modules/json-autotranslate/lib/services/deepl-free.js:14:53)
at /Users/xxx/Documents/dev/translate/node_modules/json-autotranslate/lib/services/deepl-free.js:8:71
at new Promise (<anonymous>)
at __awaiter (/Users/xxx/Documents/dev/translate/node_modules/json-autotranslate/lib/services/deepl-free.js:4:12)
I suppose json-autotranslate
isn't able to work with files that are indented that much, is that right? Is there anything I can do to make it work?
Thanks again.
from json-autotranslate.
Yes, adding -m i18next
worked perfectly. Thank you very much for the help @leolabs.
from json-autotranslate.
Glad I could help :)
from json-autotranslate.
Related Issues (20)
- Ability to specify custom matchers
- Add OpenAI GPT support
- i18next matcher fails when parsing an Array HOT 5
- issue with google translate HOT 1
- Some dependencies should be devDependencies HOT 1
- DeepL Target Language Support HOT 1
- how solve this issue about new type of json for autotranslate? HOT 2
- REQUEST: XML, YML, JS autotranslate HOT 4
- Throws error with double-brackets "{{" "}}" in json HOT 3
- How to pass Google Translate API key in --config HOT 3
- Rate Limit Exceeded HOT 1
- ICU Plurals Support fix HOT 2
- Stop automatically updating translations HOT 6
- Use custom terminology from Amazon Translate HOT 1
- Please add license file HOT 1
- How to handle input keys with "." in names HOT 2
- Better ICU handling
- ngx-translate structure not translating
- What are inconsistencies? HOT 6
- Wrong output structure HOT 1
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 json-autotranslate.