Giter Site home page Giter Site logo

Comments (8)

longlho avatar longlho commented on May 23, 2024

I'm confused. Are you trying to specify messages in ICU AST form?
type: 1 is argument, your value is just a string

from formatjs.

duc-gp avatar duc-gp commented on May 23, 2024

I'm confused. Are you trying to specify messages in ICU AST form? type: 1 is argument, your value is just a string

What is this ICU AST form you are talking about? Can you please provide a documentation? Type 0 is working, type 1 not. You can see it in my codepen example

from formatjs.

longlho avatar longlho commented on May 23, 2024

https://formatjs.io/docs/react-intl/components#intlprovider

you wanna pass in Record<string, string> to messages in your Provider

from formatjs.

duc-gp avatar duc-gp commented on May 23, 2024

https://formatjs.io/docs/react-intl/components#intlprovider

you wanna pass in Record<string, string> to messages in your Provider

Thank you but I mean the documentation for this type: 0 and type: 1 thing. Have you checked my codesandbox? If not, please see my codesandbox. There you can see that type: 0 is working but type: 1 is not.

Why is that? Can you provide a documentation for that?

from formatjs.

longlho avatar longlho commented on May 23, 2024

The payload form you're passing in is a list of MessageFormatElement chunks. Type 0 is a literal chunk. Type 1 is a argument chunks but those are implementation details.
You should pass in strings instead of passing in map of string to array. Where in the documentation do you get that param shape?

from formatjs.

duc-gp avatar duc-gp commented on May 23, 2024

The payload form you're passing in is a list of MessageFormatElement chunks. Type 0 is a literal chunk. Type 1 is a argument chunks but those are implementation details. You should pass in strings instead of passing in map of string to array. Where in the documentation do you get that param shape?

Okay I see.. so this is officially not recommended and never was or is that some kind of legacy thing how it was used to be used?

I'm working on legacy code and all the translation were like that passing arrays of objects with that type and value keys :(

from formatjs.

longlho avatar longlho commented on May 23, 2024

Those have never been supported AFAIK. The array form is our internal AST format which isn't technically public.

from formatjs.

duc-gp avatar duc-gp commented on May 23, 2024

Ok, then nevermind and thanka a lot for the clarification. This issue can be closed then

from formatjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.