How to make Date Range filter Turkish
How to make Date Range filter Turkish
Erenakgz
Posts: 8Questions: 2Answers: 0
Hi, I am using Date range filter. months are coming in English, can I change the language of this to Turkish?
This question has accepted answers - jump to:
Answers
Here are the datetime defaults that you can replace:
Found this for Turkish: https://datatables.net/plug-ins/i18n/Turkish
I rolled my own version for German but you should be able to easily adapt this for Turkish as well.
It was the first code you threw. Thank you so much.
Now, when I look at it again, when choosing the date, it is in Turkish, and after selecting the date, the text appears in English.
I think you will need to change your date formatting! That should be independent of the i18n features Data Tables provides.
I render my dates server side (English UK or German formats) and use date field masking for the respective languages as well.
Your date is a classic English US date.
@kthorngren do you have any idea how to change that?
Roland
@Erenakgz what is the date format that you want?
I use moment.js for date formatting and the like
This one looks like the Turkish locale file (very many ü and ö - like in German )
https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/locale/tr.js
Here I am using the moment locale in an Editor date field definition:
I use format 'L' and the respective moment Locale file (either "de" or "en-gb").
So you can either also use moment.js or - if the only language you support is Turkish - you just hard code the date format like in here:
I see that format 'L' in Turkish is the same as in German
Thank you very much for your help. My country's date format is dd.mm.yyyy
I am pretty sure it is case sensitive in Javascript. So rather use 'DD.MM.YYYY'
You probably didn't have "format" specified initially, right? And that is when the "default" kicks in - and in the world of software that is always English (US) I am afraid.
Finally happened. Thank you for everything.
Hello again my friend, When I do it with the date format of my own country, this time it does not list the new date in the table according to the old one. How can I solve this? @rf1234
No idea! Please post your code and your target date format in the data table.
I can only tell you how I do it:
- I do the date rendering on the server: from mysql date format to German or English UK formats and vice versa - depending on user language
- On the client side I don't do any date rendering: Users see and edit dates in their respective language (German or English UK).
Many developers however do date rendering client side. They pass the mysql date format back and forth to the server. Either way you have to make sure that
- date rendering for the data table is being done
- the date format for Editor is defined.
Both are independent of each other! You can have completely different date formats in Editor and in your Data Table.