Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Change date format...
kokudroid
New
Good afternoon from Spain,
Please see if somebody could help me ...
Does not work the setlocale() function for spanish, still showing the date in English.
How I can display it in Spanish? Example: Diciembre instead of December.
Another question: How I can show 'one day ago' or a 'five minutes ago' or ... instead of the exact date?
I hope your answer.
Regards, Kokudroid
PD: Sorry for my English.
Tagged:
0
Comments
♦locales:
http://vanillaforums.org/addon/vf_ca_es-locale
http://vanillaforums.org/addon/spanish-locale
♦plugins:
http://vanillaforums.org/addon/timeago-plugin
or search for timeago for other options.
♦documentation for locales and internationalization
http://vanillaforums.org/docs
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
I'm having the same problem, not just with Spanish. The definitions for dates in the locales don't work.
unless somebody comes up with a better idea.
I believe that has to do with your server and the way date routine strftime, etc. works in php based on setlocale function.
copy and paste this line to a file e.g. mylocalecheck.php
on a linux based server:
<?php system('locale -a') ?>this will show you the locales you have available. you may need to install a language pack for your server or generate a locale for your server os.
or modify the date format routine to substitute months for your language..
for windows you need to google for country region string setting.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
for mine I added the OS specific spanish locale language pack (not to be confused with vanilla locale addons).
for a test of locale after I added the language pack for my server I tired this
which output
jueves 13 diciembre 2012
Preferred locale for spanish on this system is 'es_ES.utf8'
after I knew that displayed correctly i changed this in the spanish transiflex
definitions.php
then added
and a mod for above suggestion - add the ;
<?php system('locale -a'); ?>
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Thanks, I've tried everything but the locales still don't work.
"everything???"
post your results from
list-locales.php (if you have a linux server).
<?php system('locale -a'); ?>A) nobody can help you unless you specify
1) your server os,
2) what web server and what locales you have available.
3) Also provide what you have in config.php with respect to:
$Configuration['Garden']['Locale']
$Configuration['EnabledLocales']
4) you might also include your vanilla version of software - always a good idea.
You are not helping yourself without providing more info.
short of that write a little routine in php after the date is returned and change it to what you want if you can't get locales working the way it should.
C) if it is not your server, ask your host provider to add the locale.
D) hire someone on this forum to write a plugin or some code to write a routine to change month names for you - if you can't get the locale working the proper way through setlocale - with the proper language packs as specified here:
E) or change the date format to only display month numbers instead of names.
e.g. 3-3 instead of March 3
http://vanillaforums.org/discussion/comment/171772/#Comment_171772
setlocale(LC_ALL, 'es_ES.utf8', 'es_ES', 'es', 'esn', 'spanish');
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Thanks Peregrine for your help.
My server is XAMPP.
In my config.php:
I have tried your code:
setlocale(LC_ALL, 'es_ES.utf8');
echo strftime("%A %e %B %Y", mktime(0, 0, 0, 12, 13, 2012));
$loc_spanish = setlocale(LC_ALL, 'es_ES.utf8', 'es_ES', 'es');
echo "Preferred locale for spanish on this system is '$loc_spanish'";
?>
which output is
For now the solution E) is easiest.
Thanks again. Try other alternatives later.
But shouldn't this be something that should be overridden with the script's locale file, no matter what sort of date formatting the server provides?
One could ask why should vanilla forums attempt to fix something that is broken on your server. You should install locales for your server os correctly if you run the server or ask your host provider to install the proper locale. Although, otoh ....
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Assuming you have no control over correctly installing locales on your server you could do this. Although you know what they say about mods to the core.
I suppose you would need some modification to the core to make it work.
worked for me.
and add this to your config.php (with your custom months e.g.'diciembre')
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Thank you!
I install locales on Vanilla. These should override everything else going on. For example, my Emoji locale, with symbols instead of words.
None of these definitions in the locale file work, but I found them in locales that can be downloaded here. Do they require a plugin? Or a different version of Vanilla?
$Definition['(YYYY-mm-dd)'] = ' (YYYY-mm-dd)';
$Definition['Date.DefaultDayFormat'] = '📆 %A %e 🕐 %H:%M';
$Definition['Date.DefaultFormat'] = '%h %i, %Y, 🕐 %H:%M';
$Definition['Date.DefaultTimeFormat'] = '🕐 %H:%M';
I install locales on Vanilla. These should override everything else going on. For example, my Emoji locale, with symbols instead of words.
@Anonymoose
You are beating a dead horse, or you don't understand the concept.
Unless you make custom modifications - you will need to get "the setlocale" function working properly on your webserver. ` The folks at vanilla decided to base dates on setlocale and strftime. if you cannot display the days and date properly in the following non-vanilla based script you did not install the regional or country locales in windows or linux, or whatever on your server.
google setlocale strftime
replace with your appropriate language.
if you did not see your language - you need to adjust your server locales.
Server locales are a different animal then vanilla locales.
On Windows, setlocale(LC_ALL, '') sets the locale names from the system's regional/language settings (accessible via Control Panel).
on a linux based server:
I searched for Date.MonthNames and found this discussion
This is a very good write-up on date localization. If I would have seen this discussion before, I would just posted the link instead of pursuing this discussion, because it says it all there clearly. It is up to you whether you want to digest it and accept it.
I already explained the ready of definitions and the order for you, if you did not see it - it is here.
over and out...
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Well then it is a bug that impedes localization efforts, plain and simple.
there's a difference between a bug and a design decision, good bad or indifferent, it's working as designed.
just make the changes to core, and submit a pull request.
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
if he did that - he couldn't carp on the discussion thread. Then what would be the fun.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
That's for people involved with developing vanilla to do. The purpose of a support forum is to relay other people's feedback to the developers to do something. I'm sorry you feel the need to somehow insult those who aren't actively involved at your level in your coding projects.
That's for people involved with developing vanilla to do. The purpose of a support forum is to relay other people's feedback to the developers to do something. I'm sorry you feel the need to somehow insult those who aren't actively involved at your level in your coding projects.
Perhaps, i did poke fun at you, my apologies. It just seems sometimes you are not looking for a solution to a problem, but occasionally you tend to be "tenacious" on something that the developers have already "decided upon". The point being either enter a problem on github, or use the feedback discussion category. Posting in a thread of a question submitted by someone else may not be read by the designers of vanilla. Sometimes, one has to live with the decisions made by the designers or you would need to make the code changes presented (assuming they work for you), if you feel they are necessary for your forum.
As far as your emoji questions - i have no idea. I don't use it.
I do agree with you about
perhaps the designers have designed it the way they did for efficiency and performance.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Please can you add one features, if the post is older the say 3 months, nothing is displayed. As I have loads of old posts and would prefer it not to say 'Posted 10 years ago', I'd prefer nothing.
You would have to write a function for that. Create a file
/conf/bootstrap.before.php
and createpublic function FormatDateCustom($Timestamp, $Format)
in there and see if you can achieve what you like. Look at/library/core/class.format.php
for inspirations how Vanilla does formatting