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: 962
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.
:idea: Learn all the tips and tricks of customizing AppGini apps through our online course.

:arrow: Summary Reports plugin enables you to build powerful reports and charts inside your AppGini application through a few simple steps. See the big picture and discover trends in your data that empower you to take the right decisions confidently.

:arrow: Search Page Maker enables you to build user-friendly yet powerful search pages for your AppGini application by simply dragging and dropping the fields you want to include in search.

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: 962
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!
:idea: Learn all the tips and tricks of customizing AppGini apps through our online course.

:arrow: Summary Reports plugin enables you to build powerful reports and charts inside your AppGini application through a few simple steps. See the big picture and discover trends in your data that empower you to take the right decisions confidently.

:arrow: Search Page Maker enables you to build user-friendly yet powerful search pages for your AppGini application by simply dragging and dropping the fields you want to include in search.

Post Reply