Coder Social home page Coder Social logo

Comments (9)

cabrerabywaters-zz avatar cabrerabywaters-zz commented on May 17, 2024

Dear @travist ,
Any idea on this? than you.

Best Regards,
Ignacio

from formio.js.

cabrerabywaters-zz avatar cabrerabywaters-zz commented on May 17, 2024

Hello @travist, @douglaselee

Sorry to keep pushing with this one but its quite important for apps with multilanguage to be able to translate dropdown items.

Any update on this?

Regards!

from formio.js.

douglaselee avatar douglaselee commented on May 17, 2024

Hi @cabrerabywaters,

This would be a good thing and I've mentioned it before in formio/formio#422. Will try to look at it when time allows but can't predict when that will be.

from formio.js.

cabrerabywaters-zz avatar cabrerabywaters-zz commented on May 17, 2024

@douglaselee ,

What I'm doing now is that I have a "Translations" resource where I manage all the App's translations, then I load those into the FormioJs i18n object. It works perfectly for 90% of the elements.

Now I need to build this functionality for the Select elements of the App that I'm working with. I was thinking about just doing some "brute force" translation of the select elements after rendering, from the i18n object that translates all the rest of the forms, but as Select2 already has multilanguage functionality makes sense to just add it in Formiojs before rendering.

I'm not familiar with the Formiojs library, but if you could point me in the right direction I could try to do it directly on the library an not on my code.

from formio.js.

douglaselee avatar douglaselee commented on May 17, 2024

Hi @cabrerabywaters,

Maybe take a look at...

  /**
   * Translate a text using the i18n system.
   *
   * @param {string} text - The i18n identifier.
   * @param {Object} params - The i18n parameters to use for translation.
   */
  t(text, params) {
    params = params || {};
    params.component = this.component;
    params.nsSeparator = '::';
    params.keySeparator = '.|.';
    params.pluralSeparator = '._.';
    params.contextSeparator = '._.';
    return i18next.t(text, params);
  }

...in formiojs\src\components\base\Base.js and see how it's used in the repository. Good luck.

from formio.js.

cabrerabywaters-zz avatar cabrerabywaters-zz commented on May 17, 2024

@douglaselee,
What do you think about doing this? #262

Don't know if its the best approach but works fine for me.

from formio.js.

douglaselee avatar douglaselee commented on May 17, 2024

Hi @cabrerabywaters,

Looks good. Might be more efficient to consolidate 2 instances of this.itemTemplate(item).replace(/<\/?[^>]+(>|$)/g, "") into a single variable but no big deal.

Thanks for the assist!

from formio.js.

cabrerabywaters-zz avatar cabrerabywaters-zz commented on May 17, 2024

Hello @douglaselee,

Oh! sure! I just pushed the fix for that.
Hope it helps!

from formio.js.

douglaselee avatar douglaselee commented on May 17, 2024

Thanks again @cabrerabywaters, this will definitely help!

from formio.js.

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.