opral / monorepo

lix (change control system) && inlang (globalization ecosystem for software built on lix)
https://opral.com
Apache License 2.0
1.22k stars 107 forks source link

[bug] <ERROR: (intermediate value) is not iterable> #1409

Closed MaxMillington closed 1 year ago

MaxMillington commented 1 year ago

Problem

Sometimes, when running machine-translate, I'm getting this error:

ERROR (intermediate value) is not iterable

My JSON is well formed. It fails on this key/value pair:

"unbondingPeriodTooltip": "Locked tokens increase stability for the blockchain. When you unstake your tokens, they will be available after the specified unbonding period."

What causes this error to throw?

EDIT:

Here is my json object:

"stake": {
    "available": "Available",
    "MAX": "MAX",
    "validatorHeader": "Stake squad",
    "edit": "Edit",
    "stake": "Stake OSMO",
    "unstake": "Unstake OSMO",
    "estimatedEarnings": "Estimated earnings",
    "unbondingInProgress": "Unstaking in progress",
    "amount": "Amount",
    "availableIn": "Available in",
    "day": "day",
    "days": "days",
    "month": "month",
    "dashboard": "Dashboard",
    "rewardsTitle": "Unclaimed rewards",
    "stakeBalanceTitle": "Total staked balance",
    "viewAll": "View All",
    "collectRewards": "Collect rewards",
    "investRewards": "Collect and re-invest",
    "learn": "Learn more",
    "alertTitleBeginning": "Earn",
    "alertTitleEnd": "APR",
    "alertSubtitle": "by staking your OSMO",
    "mainCardButtonText": "Stake",
    "mainCardButtonUnstakeText": "Unstake",
    "unbondingHeader": "Unbonding period",
    "unbondingSubtext": "Once this period has elapsed, you may access your OSMO under the assets tab"
  },

It seems to fail whenever I add anything beyond this current JSON list.

Expected behavior

No response

Reproduction

Try running inlang machine-translate with this key/value pair:

"unbondingPeriodTooltip": "Locked tokens increase stability for the blockchain. When you unstake your tokens, they will be available after the specified unbonding period."

Or try adding any key value pair to the above JSON blob

Other information

No response

felixhaeberle commented 1 year ago

@MaxMillington Thanks for reporting this bug! :) I'll investigate. Are you running on the latest CLI version? You can make sure to have the latest version with the latest flag npx @inlang/cli@latest machine translate

felixhaeberle commented 1 year ago

@MaxMillington Hey, investigated this on my side. Unfortunately can't reproduce what you describe. See the output, I added the message which should fail.

> npx @inlang/cli@latest machine translate

 WARN  Human translations are better than machine translations.                                                                                            00:24:32

We advise to use machine translations in the build step without commiting them to the repo. By using machine translate in the build step, you avoid missing translations in production while still flagging to human translators that transaltions are missing. You can use the force flag (-f, --force) to skip this prompt warning.

✔ Are you sure you want to machine translate? … yes
ℹ 📝 Translating to 1 languages.                                                                                                                          00:24:33
ℹ ✅ Machine translated message "stake.available"                                                                                                         00:24:33
ℹ ✅ Machine translated message "stake.MAX"                                                                                                               00:24:33
ℹ ✅ Machine translated message "stake.validatorHeader"                                                                                                   00:24:33
ℹ ✅ Machine translated message "stake.edit"                                                                                                              00:24:33
ℹ ✅ Machine translated message "stake.stake"                                                                                                             00:24:34
ℹ ✅ Machine translated message "stake.unstake"                                                                                                           00:24:34
ℹ ✅ Machine translated message "stake.estimatedEarnings"                                                                                                 00:24:34
ℹ ✅ Machine translated message "stake.unbondingInProgress"                                                                                               00:24:34
ℹ ✅ Machine translated message "stake.unbondingPeriodTooltip"                                                                                            00:24:34
ℹ ✅ Machine translated message "stake.amount"                                                                                                            00:24:34
ℹ ✅ Machine translated message "stake.availableIn"                                                                                                       00:24:34
... more

Can you possibly share your project.inlang.json file?

felixhaeberle commented 1 year ago

@NiklasBuchfink ERROR (intermediate value) is not iterable – Was this the bug we fixed a few days ago? Then it should be only about updating the CLI.

MaxMillington commented 1 year ago

@felixhaeberle I'm on 0.13.3

Here is my project file:

{    
  "$schema":"https://inlang.com/schema/project-settings",
    "sourceLanguageTag": "en",
    "languageTags": ["en", "es", "fa", "fr", "ko", "pl", "pt-br", "ro", "tr", "zh-cn", "zh-hk", "zh-tw"],
    "modules": [
        "https://cdn.jsdelivr.net/npm/@inlang/plugin-json@4/dist/index.js",
        "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@1/dist/index.js",
        "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-identical-pattern@1/dist/index.js",
        "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@1/dist/index.js",
        "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@1/dist/index.js"
    ],
    "plugin.inlang.json": {
        "pathPattern": "./packages/web/localizations/{languageTag}.json"
    }
}
felixhaeberle commented 1 year ago

@MaxMillington This doesn't seem right, the current CLI verson is 1.8.0. Can you execute npx @inlang/cli@latest machine translate and see if this resolves your issue?

Alternatively, to verify your CLI version, you an run npx @inlang/cli@latest -V.

MaxMillington commented 1 year ago

@felixhaeberle I just upgraded to the latest version. That fixed it. Thanks!

felixhaeberle commented 1 year ago

@MaxMillington Great to hear!! 🎉

If there is anything we can help you with, don't hesitate to open issues for features or if you stumble over bugs, we would be very grateful if you report them. Happy coding!!! :)

felixhaeberle commented 1 year ago

@inlang/cli Can we introduce an alert / info if a new version of the CLI is available when running one of the commands? Therefore, users don't have to open issues & can try to debug things by installing the latest version of the CLI.

TLDR: I'll create an issue for alerting the user in case of a new version of the CLI.