Elxis CMS Forum

Support => Language => Topic started by: golden76 on March 10, 2007, 17:38:16

Title: where is the date lang file?
Post by: golden76 on March 10, 2007, 17:38:16
i cant find the date word in main lang file. where is it? WEEK and MONTH word. thanks:)
Title: Re: where is the date lang file?
Post by: eliasan on March 10, 2007, 18:38:51
Hi,

I don't think there are such words in language files.

What are you trying to do?
Title: Re: where is the date lang file?
Post by: Ivan Trebješanin on March 10, 2007, 19:45:02
If you're talking about last updated, published etc... it depends on your server and localisation it provides. As for my case (Serbian) it could be one of the following, depending on a server: sr, sr-SR, sr_SR, srCS, sr_CS.utf8... but you have to experiment. Following is the PHP code that would give you the info needed:

<?php
/* Proverava koji local settings je podržan na hosting serveru */
/* Preimenivati u datoteku sa ekstenzijom .php (npr: datum.php */
/* Dodati na serer i pokrenuti (npr: http://www.mojdomen.com/datum.php */
/* Rezultat upisati u admin joomle (Global configuration/Locale/Country locale  */

$loc_sr = setlocale (LC_ALL, 'sr_YU.ISO8859-5', 'sr_YU.ISO8859-2', 'sr_YU@cyrillic.UTF-8', 'sr', 'sr_CS', 'sr_CS.UTF-8', 'sr_YU.UTF-8');
echo "Preporu&#269;ena lokalzacija na ovom serveru je: '$loc_sr'";
phpinfo();
?>

This script is intended for use with joomla!, but I'm shure it could give you the info needed  ;)
Title: Re: where is the date lang file?
Post by: Ivan Trebješanin on March 10, 2007, 19:54:53
Sorry, I haven't translated the comments...

<?php
/* Checking wich locale setting is supported by server */
/* Copy this code into a file with *.php extension(eg: date.php */
/* Upload to a server (eg: http://www.mydomain.com/date.php */
/* Write the result into joomla! (Global configuration/Locale/Country locale  */

$loc_sr = setlocale (LC_ALL, 'sr_YU.ISO8859-5', 'sr_YU.ISO8859-2', 'sr_YU@cyrillic.UTF-8', 'sr', 'sr_CS', 'sr_CS.UTF-8', 'sr_YU.UTF-8');
echo "Recomended localisation on this server is: '$loc_sr'";
phpinfo();
?>

Now it could be used by anyone  :D
Title: Re: where is the date lang file?
Post by: datahell on March 10, 2007, 20:43:11
No, you dont need to translate dates (although month names are in gemini files)!
If you have set locale to auto (as we recommend) php can translate the dates for you!

The following example displays the month name of 10-03-2007 (March):

Code: (php) [Select]
$d = date('Y-m-d H:i:s', mktime(0,0,0,'03','10','2007'));
$day= mosFormatDate($d, "%B");


Note: windows do not support utf8 locales so the dates will be displayed in english in windows.
Title: Re: where is the date lang file?
Post by: Ivan Trebješanin on March 10, 2007, 20:53:56
So it's true, I forgot... but then, there are not much serious windows based servers. I just wanna add that I even have one site on a server wich disables my updiag functionality. But these ARE NOT the usual cases. In most cases, the script will give you much needed info. After that, guys at elxis.org will tell you what to do with it. ;)
Title: Re: where is the date lang file?
Post by: datahell on March 11, 2007, 11:56:49
Jazzman something else: For the serbian locale (and any locale) add first the utf8 parts!
Title: Re: where is the date lang file?
Post by: Ivan Trebješanin on March 11, 2007, 14:07:37
Speaking of utf8... did you get my email with translations?
Title: Re: where is the date lang file?
Post by: datahell on March 11, 2007, 17:10:03
Yes, Jazzman but I did nt get the time to deal with it. Give me 1-2 days. ;)
Title: Re: where is the date lang file?
Post by: Ivan Trebješanin on March 11, 2007, 17:25:51
OK, I'm ill at the moment so a vacation for me is a good thing. :P
Title: Multi-lingual dates
Post by: datahell on March 11, 2007, 20:17:35
Conclusion for the multilingual dates:

Month name are located inside the main frontend language files ie (german.php, english.php, serbian.php etc).

Example for German:
DEFINE('_JAN','Januar');
DEFINE('_FEB','Februar');
DEFINE('_MAR','März');
DEFINE('_APR','April');
DEFINE('_MAY','Mai');
DEFINE('_JUN','Juni');
DEFINE('_JUL','Juli');
DEFINE('_AUG','August');
DEFINE('_SEP','September');
DEFINE('_OCT','Oktober');
DEFINE('_NOV','November');
DEFINE('_DEC','Dezember');

BUT you can display any part of the date without language file if you have locale set to auto .

How it works
Lets say we need to display the multilingual name of "Monday". We need a date that we know that it was Monday. Today (2007-03-11) is Sunday so tommorow will be monday, so this date is fine for our work (used date can be any valid date even in the future).

So the multi-lingual name of Monday is:
mosFormatDate('2007-03-11 01:00:00', "%A");
Of Thuesday:
mosFormatDate('2007-03-12 01:00:00', "%A");
and so, on.

The names of the months can be taken with a trick like above.
March:
mosFormatDate('2007-03-01 01:00:00', "%B");
April:
mosFormatDate('2007-04-01 01:00:00', "%B");
etc.

Hope that helped  ;)
Title: Re: where is the date lang file?
Post by: Ivan Trebješanin on March 15, 2007, 19:01:26
Thanx Datahell, it was usefull from developer's POW, but, I wanted to ask this: Is there an option to add locale manually, if auto option fails? I don't see, ie, Serbian locale in the dropdown list. I ask this on behalf of many potential elxis users, that I try to port from joomla cms.
Title: Re: where is the date lang file?
Post by: datahell on March 15, 2007, 19:08:06
Serbian locale is just missing from the relative list in the global configuration panel but the support for the Serbian language exist in Elxis. So, if you have set locale to auto, then for all users that have Serbian language locale will be set to Serbian.

'serbian' => array('sr_CS.utf8@euro', 'sr_CS.utf8', 'sr_CS'),

I just added serbian to the list. Thanks for your observation.

I want something from you, I want to tell me the locale for the "Serbian latin" language. I think it must be different than the cyrilic, is n't it?
Title: Re: where is the date lang file?
Post by: Ivan Trebješanin on March 15, 2007, 20:26:42
I've been busy on that subject lately, but, there are so many possible answers (according to ISO)... eg:
sr_lat, sr_YU, sh-SR... I've lived in more countries than I've had girfriends...   :D
Title: Re: where is the date lang file?
Post by: datahell on March 15, 2007, 20:40:03
I need the proper one... You can not have 2 locales for the same language! If you dont find the answer I will search the server's locales to find the most suitable. I think the problem is that Serbia has many political changes during last years and the country name as long as the locale have been changed. We must find the current locale for Serbian latin language.

You can find the locale with a test. Go to your (UNIX) server and upload a php file.
Add inside this file the following code:

<?php
setlocale (LC_COLLATE, 'YOUR LOCALE HERE');
setlocale (LC_CTYPE, 'YOUR LOCALE HERE');
setlocale (LC_TIME, 'YOUR LOCALE HERE');

header( 'Content-type: text/plain; charset=utf-8' );

echo strftime("%A, %d %B %Y %H:%M", time());

?>

Save this file as test.php and run it with your browser (www.mysite.com/test.php) .
Does the date appears in Serbian latin correctly? If no, change the locale and test another one. Test all possible locales and tell me your test results.

Notice: You must set only utf8 locales (ie sr_CS.utf8 not just sr_CS).

PHP manual for locale: http://www.php.net/manual/en/function.setlocale.php

Serbian locales: http://unicode.org/cldr/data/diff/summary/sr.html

Hope that helped.
Title: Re: where is the date lang file?
Post by: Ivan Trebješanin on March 15, 2007, 20:44:33
well, this shurely is a nice appendix to the script I already used...

thnx
Title: Re: where is the date lang file?
Post by: Ivan Trebješanin on March 15, 2007, 21:31:57
Hi, datahell

Here is the result of my investigation on serbian latin locale: bs_BA.UTF-8. Believe it or not, I had to put bosnian serbian as the language to get latin UTF-8!!!!


cheers  :P
Title: Re: where is the date lang file?
Post by: Ivan Trebješanin on March 16, 2007, 01:25:30
Oh, it's me again...  :( It seems that locale for bosnian serbian is not what I was looking for!!! It's just another dialect of serbian, but obvious at some weekdays (Monday, Thursday...), so I must digg even some more. But, it's as you said: There could not be 2 locales for one country... but then, it's Serbia we're talking about! This is kind of wonderland. :D
Title: Re: where is the date lang file?
Post by: datahell on March 16, 2007, 18:04:34
If it is difficult for you to find the proper locale for your language for us it will be imposible! There is also another issue that affects other languages also. The name for the serbian latin language can not contain the word "serbian"! Elxis language system supposes that each language name is unique and distinct. If you have 2 languages ie serbian and serbian_lat then when you filter content by language Elxis search for content items like this:

WHERE language LIKE %$lang% OR language IS NULL

The NULL value returns items that are available for all languages.
The first part of the query above searches the language column for matches of the $lang variable. So if a user has selected "serbian" language Elxis will return him results for both the "serbian" and the "serbian_lat" language. Thats why in the next release we will perform renaming to some problematic language like serbian (serbian_cyr / serbian_lat), spanish (spanish_mexico will become mexican), etc.
Title: Re: where is the date lang file?
Post by: Ivan Trebješanin on March 16, 2007, 18:27:22
Well... seems pretty discouraging. I've already posted topic on rewritting mosCurrentDate. As for DB related problem, I couldn't think of anything else but renaming laguages to: sr_lat and sr_cyr. I think this would solve it. Since I'm awaiting just for that approval for serbian latin lingo to put my personal site online, and I need the solution fast, would you be so kind to read my topic about rewritting mos CurrentDate? I always hated enormous hacking to get joomla! to work with unicode, and it would be my last solution to go back to joomla!