Allow to change formatDate language at Project Settings

Hi,
Using NodeJS project, I have not testing in php projects.

Maybe, spanish speaker we are a few ones, but the same in other languages, so, would be great if at project level settings we can customize the “formatter” language.

Please allow to select the locale file that contains all the validation message and dates language:
/lib/locale/en-US.js

Right now manually in this folder “/lib/locale/” duplicate the file “en-US.js” and rename it to proper language, in my case “es-US.js”, then translate all months, monthsShort, days, daysShort and all validator message. In the file /lib/validator/index.js change too in line 100 in last part the locale.
Save it.

In Wappler version “5.4.1”. Now open “/lib/core/util.js” and replace in line 141 the last locale language “en-US” by the new one, in my case ‘es-US’ Save file.

Finally, if use docker redeploy the project.

From now we are able to use formatDate without any tricky way, no custom js to create formatDate2 and adding moment with locales framework. It work natively in the previously configured language.
And plus it works using “Server Side Binding” directly, because there is no easy way to use formatDate in another language in server side, the tricky way is all after server side while loading all js library.

Please allow to change formatters language at level of project setting.
Community can provide locale files (e.g. es-US) in own native language, in this way there is no need to load moment with locales js file that have 319kb.
Besides, using moment.js custom formatter in Server Side Binding is not possible out of the box.

Example, this is my html using Server Side Binding:

<div class="home_botones_estilo btn btn-effect-1 text-center shadow pt-1 pb-1 w-100">Finaliza <%=_('bienes_muebles.data['+i+'].hasta.formatDate(\'dddd dd MMMM | H:mm\')',locals)%></div>

And of course this get rendered:
image

As you can see date language is not correct, it should be "Finaliza Sábado 11 marzo | 21:41".

After doing this:

It works, but only when using Server Side Binding.
image

What I’m requeting is to allow change language of formatters and validations per project, to avoid load an excesive 319kb and allow to use dates formatter in other language using Server Side Binding.

Thanks

1 Like

¡Bump!