Page 1 of 1

Translating months and days in SPM´s datepicker

Posted: 2018-06-19 16:26
by wilmira
Hello everybody,

Does anybody knows how to translate the days and months in Search Page Maker Plugin´s datepicker.

I have tried by placing this code in the hook/page_filter.php created by the plugin:

<script type="text/javascript" src="resources/moment/locale/es.js"></script>

But it inot translating to Spanish, it will always shows the months and days in English.

Re: Translating months and days in SPM´s datepicker

Posted: 2018-06-20 19:53
by AhmedBR
try using this in the hook init

sql("SET lc_time_names=es_ES", $eo);

https://dev.mysql.com/doc/refman/8.0/en ... pport.html


Hope this works for you ;)

Re: Translating months and days in SPM´s datepicker

Posted: 2018-06-20 19:56
by AhmedBR
for datepicker here is an example code on how to do it:
https://pt.stackoverflow.com/questions/ ... para-pt-br

Re: Translating months and days in SPM´s datepicker

Posted: 2018-06-20 23:08
by wilmira
Thank you very much AhmedBR,

This was all I needed to make it work, the code is different to the one of the example, but it is just a matter to add a single line of code to the one you already have. So you only need to look for the code below in the table_filter.php file (table is the name of your table), generated by SPM:

<script>
$j(function(){
//date
$j("#from-date_6 , #to-date_6 ").datetimepicker({
format: 'DD/MM/YYYY',
locale: 'es-Es'
});

$j("#from-date_6" ).on('dp.change' , function(e){
date = moment(e.date).add(1, 'month');
$j("#to-date_6 ").val(date.format('DD/MM/YYYY')).data("DateTimePicker").minDate(e.date);
});
});
</script>

The single line of code added was: locale: 'es-Es'

Re: Translating months and days in SPM´s datepicker

Posted: 2018-06-24 02:05
by a.gneady
Thanks for sharing the code. We'll add ability to specify locale used for datetime picker in the language.php file in future releases to make this easier.

Tip for people reaching this thread through search: To get a list of supported locales, open your AppGini app in a browser (any page) and press F12 to open the inspector, then go to the console tab and type

Code: Select all

moment.locales()
This should list all supported locales.

Re: Translating months and days in SPM´s datepicker

Posted: 2018-07-07 00:10
by wilmira
That would be great Ahmad,

I think that SPM needs a translation space in language.php, because, the generated filter has some words in English. Right now, the only thing we can do is to translate everything right into the page_filter.php page itself.

Re: Translating months and days in SPM´s datepicker

Posted: 2018-09-26 12:11
by a.gneady
You're right. We plan to fix this in the next version of SPM. Stay tuned!