Translating months and days in SPM´s datepicker

Topics related to AppGini plugins/add-ons go here.
Post Reply
wilmira
Veteran Member
Posts: 48
Joined: 2013-07-11 18:00

Translating months and days in SPM´s datepicker

Post by wilmira » 2018-06-19 16:26

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.

AhmedBR
Veteran Member
Posts: 190
Joined: 2013-09-19 10:23

Re: Translating months and days in SPM´s datepicker

Post by AhmedBR » 2018-06-20 19:53

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 ;)

AhmedBR
Veteran Member
Posts: 190
Joined: 2013-09-19 10:23

Re: Translating months and days in SPM´s datepicker

Post by AhmedBR » 2018-06-20 19:56

for datepicker here is an example code on how to do it:
https://pt.stackoverflow.com/questions/ ... para-pt-br

wilmira
Veteran Member
Posts: 48
Joined: 2013-07-11 18:00

Re: Translating months and days in SPM´s datepicker

Post by wilmira » 2018-06-20 23:08

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'

User avatar
a.gneady
Site Admin
Posts: 938
Joined: 2012-09-27 14:46
Contact:

Re: Translating months and days in SPM´s datepicker

Post by a.gneady » 2018-06-24 02:05

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.
AppGini: Responsive, collaborative web db apps in minutes.
:idea: Learn all the tips and tricks of customizing AppGini apps through our online course.

wilmira
Veteran Member
Posts: 48
Joined: 2013-07-11 18:00

Re: Translating months and days in SPM´s datepicker

Post by wilmira » 2018-07-07 00:10

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.

User avatar
a.gneady
Site Admin
Posts: 938
Joined: 2012-09-27 14:46
Contact:

Re: Translating months and days in SPM´s datepicker

Post by a.gneady » 2018-09-26 12:11

You're right. We plan to fix this in the next version of SPM. Stay tuned!
AppGini: Responsive, collaborative web db apps in minutes.
:idea: Learn all the tips and tricks of customizing AppGini apps through our online course.

Post Reply