What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hallo Channel, does anyone know if we can use translations within the Yves components typescript? In

U01AM1YGRC2
U01AM1YGRC2 Posts: 71 πŸ§‘πŸ»β€πŸš€ - Cadet
edited July 2021 in Help

Hallo Channel, does anyone know if we can use translations within the Yves components typescript? In twig we can call {{ 'my.key.for.translation' | trans }} which then looks at glossary store for a suitable translation to this key,

is there a possible way to use similar keys in JS/Typescript to translations via glossaries more dynamically?

Comments

  • U024HCR39J7
    U024HCR39J7 Posts: 49 πŸ§‘πŸ»β€πŸš€ - Cadet

    You can use data-variable in twig .. And than use this param in JS/Typescript

  • U024HCR39J7
    U024HCR39J7 Posts: 49 πŸ§‘πŸ»β€πŸš€ - Cadet

    or attribute

  • U024HCR39J7
    U024HCR39J7 Posts: 49 πŸ§‘πŸ»β€πŸš€ - Cadet

    In component use

  • U01AM1YGRC2
    U01AM1YGRC2 Posts: 71 πŸ§‘πŸ»β€πŸš€ - Cadet

    Hello Alexander, thanks for the fast reply. I think that’s not my problem. I want to use the glossary translations like we have in twig (e.g. ther pipe trans twig function) , in Typescript but not via page reload, instead we need that dynamically.

    In other frameworks there is something like i18n stores which handle translations in dynamic frontends. So my question was, if there is any similar in Spryker Yves which I can use in Typescript (Javascript)

  • U024HCR39J7
    U024HCR39J7 Posts: 49 πŸ§‘πŸ»β€πŸš€ - Cadet

    Yep.. Another way I don`t know sorry =(

  • U0145CP9Q6Q
    U0145CP9Q6Q Posts: 123 πŸ§‘πŸ»β€πŸš€ - Cadet

    @U01AM1YGRC2 no. they don't have anything like this.

  • U0145CP9Q6Q
    U0145CP9Q6Q Posts: 123 πŸ§‘πŸ»β€πŸš€ - Cadet
  • U01AM1YGRC2
    U01AM1YGRC2 Posts: 71 πŸ§‘πŸ»β€πŸš€ - Cadet

    Today I find a workaround for out problem, but in the future this would be a good improvement, if this translations can be reached via JS.

  • U01AM1YGRC2
    U01AM1YGRC2 Posts: 71 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited July 2021

    and BTW I knew that same from Magento, they have functions to add translations in a dynamic context such as JS (JS with jQuery)