Js-lingui: [Pseudo Localization] Syntax tokens shouldn't be pseudo localized

Created on 25 Sep 2020  路  15Comments  路  Source: lingui/js-lingui

Describe the bug

Pseudolocalization mutates syntax tokens, for example in the follow select syntax the key "screener" is mutated as well as the select keyword.

Error: Can't parse message. Please check correct syntax: "哦艒农艜 匹艜艒v末膹膿艜 艣膿艅牛 脿 {0, 艣膿暮膿膰牛, 艣膰艜膿膿艅膿艜 {诺膿暮暮艅膿艣艣 脿艣艣膿艣艣m膿艅牛} other {{assessmentType}}} 茠艒艜 欧艒农 牛艒 牛脿姆膿. 皮暮膿脿艣膿 牛脿姆膿 脿 茠膿诺 m末艅农牛膿艣 牛艒 膰艒m匹暮膿牛膿 牛磨末艣 脿艣艣膿艣艣m膿艅牛 苺膿茠艒艜膿 欧艒农艜 艅膿x牛 脿匹匹艒末艅牛m膿艅牛."

To Reproduce
Steps to reproduce the behavior, possibly with minimal code sample, e.g:

import { Trans } from "@lingui/react"

export default function App() {
   return (
    <div>
      Your provider sent a{' '}
            <Select
              value={isScreenerAssessment ? 'screener' : 'other'}
              screener="wellness assessment"
              other={assessmentType}
            />{' '}
            for you to take. Please take a few minutes to complete this
            assessment before your next appointment.
    </div>
}

Expected behavior
Syntax and tokens are unchanged, only actual language.

Additional context
Add any other context about the problem here.

  • jsLingui version: 2.9.1
accepted 馃悶bug 馃摝 cli

Most helpful comment

Okay i fix #919 asap

All 15 comments

This definitely shouldn't happen, thanks for report.

Could you please checkout next branch and test, if the problem persists in v3? If so, feel free to send PR, but please use next branch as a base (it should be relesed early November). Let me know if I can help somehow

Hello @tricoder42 I can have a look at this issue

@MartinCerny-awin Perfect, thanks a lot!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Should this be really closed?

Probably this issue is already fixed mate.

Unfortunately no, the issue still happens with 3.4.0.

oh, alright i'll take a look then

I think Select is the last one that is missing. I am waiting for this issue to get fixed https://github.com/lingui/js-lingui/issues/919

@pauloborges is it Select that you are having issues with?

@MartinCerny-awin, exactly!

Okay i fix #919 asap

@MartinCerny-awin #919 is merged feel free to improve select pseudolocaliaztion.

You can introduce this test:

  it("Select", () => {
    expect(
      pseudoLocalize(
        "{gender, select, male {He} female {She} other {<span>Other</span>}}"
      )
    ).toEqual(
      "{gender, select, male {膜膿} female {艢磨膿} other {<span>艑牛磨膿艜</span>}}"
    )
  })

Awesome! Thanks for the quick fix!

A final question: any idea when a new release would be drafted?

Awesome! Thanks for the quick fix!

A final question: any idea when a new release would be drafted?

We like to release new version each Tuesday. So the next Tuesday will include this fix =)

Released ^3.5.0

Was this page helpful?
0 / 5 - 0 ratings