Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The sync command crashes with Error: Callback was already called #79

Closed
selindho opened this issue Nov 23, 2022 · 1 comment
Closed
Assignees

Comments

@selindho
Copy link

🐛 Bug Report

locize sync crashes with Error: Callback was already called. when using the android format and there are multiple <plurals>...</plurals> blocks.

To Reproduce

Given a directory with the following structure:

.
`-- en
    `-- strings.xml

where strings.xml contains the following:

<?xml version="1.0" encoding="utf-8"?><resources>
    <plurals name="a">
        <item quantity="one">A</item>
        <item quantity="other">AA</item>
    </plurals>
    <plurals name="b">
        <item quantity="one">B</item>
        <item quantity="other">BB</item>
    </plurals>
</resources>

Run the following:

locize sync --project-id {omitted} --api-key {omitted} --format android --dry=true

This results in:

/Users/user/.nvm/versions/node/v18.12.1/lib/node_modules/locize-cli/node_modules/async/dist/async.js:324
            if (fn === null) throw new Error("Callback was already called.");
                             ^

Error: Callback was already called.
    at /Users/user/.nvm/versions/node/v18.12.1/lib/node_modules/locize-cli/node_modules/async/dist/async.js:324:36
    at /Users/user/.nvm/versions/node/v18.12.1/lib/node_modules/locize-cli/node_modules/async/dist/async.js:248:17
    at /Users/user/.nvm/versions/node/v18.12.1/lib/node_modules/locize-cli/parseLocalLanguage.js:151:11
    at FSReqCallback.oncomplete (node:fs:208:5)

Expected behavior

If the contents of strings.xml are replaced with:

<?xml version="1.0" encoding="utf-8"?><resources>
    <plurals name="a">
        <item quantity="one">A</item>
        <item quantity="other">AA</item>
    </plurals>
</resources>

The output of locize sync --project-id {omitted} --api-key {omitted} --format android --dry=true is:

adding 2 keys in en/strings...
would add a.one, a.other in en/strings...
syncing...
FINISHED

I expect the sync work in the same manner, even if there are multiple plurals-blocks in strings.xml.

Your Environment

  • runtime version: node v18.12.1
  • module version: 7.12.8
  • os: Mac
@adrai adrai self-assigned this Nov 23, 2022
@adrai adrai closed this as completed in a4e1d10 Nov 23, 2022
@adrai
Copy link
Collaborator

adrai commented Nov 23, 2022

v7.12.9 should fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants