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

@lingui/remote-loader unable to process ICU select #1087

Closed
St0necrusher opened this issue Jun 16, 2021 · 2 comments
Closed

@lingui/remote-loader unable to process ICU select #1087

St0necrusher opened this issue Jun 16, 2021 · 2 comments

Comments

@St0necrusher
Copy link

St0necrusher commented Jun 16, 2021

Hi!
Remote loader unable to parse ICU Select, with following error:

    SyntaxError: Unexpected token s in JSON at position 40
        at JSON.parse (<anonymous>)

Example:


import { remoteLoader } from "@lingui/remote-loader"

async function testFunction() {
    const messages = await simulatedJsonResponse()
    const remoteMessages = remoteLoader({messages})
}

function simulatedJsonResponse() {
  return new Promise((resolve) => {
    resolve({
      "customKey": "{someVariable, select, someVarValue {SomeTextHere} other {SomeOtherText}}"
    })
  })
}

testFunction()

@semoal
Copy link
Contributor

semoal commented Jun 16, 2021

Yep, confirmed native JSON.parse is not smart enough. Releasing a new version right now

@semoal
Copy link
Contributor

semoal commented Jun 16, 2021

Give it a try to 3.10.4, just released. Should work fine :)

@semoal semoal closed this as completed Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants