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..

hello. does spryker have the translations functionality in javascript?

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

hello. does spryker have the translations functionality in javascript?

Comments

  • U01SE4SRCU9
    U01SE4SRCU9 Posts: 68 πŸ§‘πŸ»β€πŸš€ - Cadet

    Not sure about JS, but you definitely have it in twig (trans filter).

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

    in twig i know. but i need in js :)

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

    for example smth similar to magento like $.mage.__('String to translate')

  • U01SE4SRCU9
    U01SE4SRCU9 Posts: 68 πŸ§‘πŸ»β€πŸš€ - Cadet

    I'm not sure you're even supposed to be doing that. Why would you need a translation in JS?

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

    for example i want to add custom frontend form validation and need to show error messages in current language.
    or another case. i have payment integration with payone and it also validates the credit card form and return the error messages. I want to change the text of this messages to the custom one in current language

  • U01SE4SRCU9
    U01SE4SRCU9 Posts: 68 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited June 2021

    Ah, ok. I'm more into BE, so hopefully someone else will be able to help you there. πŸ™‚

  • U01SE4SRCU9
    U01SE4SRCU9 Posts: 68 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited June 2021

    Just an idea, though: could you perhaps put the possible error messages with their glossary entries into those page's twigs in advance, by default, translate them there (in the twig), and just hide them, only revealing them (with JS) in case of an error?

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

    yes i was thinking about it. but this is ok for 1-2 messages as for me. i have around 5-6. and what if customer will want to extend the list?