Welcome,
Guest
.
Please
login
or
register
.
Did you miss your
activation email
?
News:
Download Elxis CMS:
Elxis 5.5 Hermes
.
Home
Help
Login
Register
Elxis CMS Forum
»
Support
»
Language
(Moderator:
Farhad Sakhaei
) »
Rewritting mosCurrentDate
« previous
next »
Print
Pages: [
1
]
Author
Topic: Rewritting mosCurrentDate (Read 18196 times)
Ivan Trebješanin
Elxis Team
Hero Member
Posts: 1663
Rewritting mosCurrentDate
«
on:
March 16, 2007, 14:17:02 »
I have a question: would it be wise to rewritte function mosCurrentDate?
My problem is serbian locale, wich is not fully supported by all systems, due to the problem with double locale (cyrillic and latin). Trouble is that those two locales are treated as different languages, not as merely different graphical layouts of the same language. Amd we all know there can be only one locale per country. So, all I could think of is a little workaround at mosCurrentDate. Here is what I have in mind:
function mosCurrentDate() {
# Ime dana
$dani = array("Недеља", "Понедељак", "Уторак", "Среда", "Четвртак", "Петак", "Субота");
$dan = $dani[date("w")];
# Datum u brojkama
$datum = date("j");
# Mesec
$meseci = array("јануар", "фебруар", "март", "април", "мај", "јун", "јул", "август", "септембар", "октобар", "новембар", "децембар");
$mesec = $meseci[date("n")-1];
# Godina
$godina = date("Y");
$date = "$dan, $datum $mesec $godina";
return $date;
}
And:
$dani = array("Nedelja", "Ponedeljak", "Utorak", "Sreda", "Četvrtak", "Petak", "Subota");
$meseci = array("Jan", "Feb","Mrt","Apr","Maj","Jun","Jul","Aug","Sep","Okt","Nov","Dec");
What I would like to know is would it somehow interfere with the rest of Elxis core?
Logged
I've got a snap in my finger...
Got rhythm in my walk...
datahell
Elxis Team
Hero Member
Posts: 10356
Re: Rewritting mosCurrentDate
«
Reply #1 on:
March 16, 2007, 22:44:28 »
You do not have to re-write mosCurrentDate function!
All you have to do is to add an extra line at /includes/Core/locale.php file
Open locale.php
You will find an array of unix locales that points language names to locales.
For example for "serbian" language we have:
'serbian' => array('sr_CS.utf8@euro', 'sr_CS.utf8', 'sr_CS'),
now lets add something like this:
'custom_lang' => array('el_GR.utf8@euro', 'el_GR.utf8', 'el_GR'),
What we did? We told the system when the user has selected the "custom_lang" language to load locales for Greek language!
So you can have something like this:
'serbian_cyr' => array(serbian cyrilic locales here),
'serbian_lat' => array(serbian latin locales here),
Inside the array we write one or more locales. The system will try to use the first one. If it does not exist on the server that hosts our site it will try to load the second, then the third, the forth etc...
You can name your language files whatever you like but they must be mapped in the locale.php file to the right locale. In the next version we will do these changes. You can do this from now for your site. It is not good to use custom naming on language as we break the Elxis standards. Please use: "serbian_cyr" and "serbian_lat". Leave instact "serbian" locale, you can have for serbian as many rows as you like. Dont use not-utf-8 locales!
«
Last Edit: March 16, 2007, 22:46:28 by datahell
»
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
Ivan Trebješanin
Elxis Team
Hero Member
Posts: 1663
Re: Rewritting mosCurrentDate
«
Reply #2 on:
March 17, 2007, 03:01:17 »
Thanx, this is usefull, but it relies on the support of the hosting machine. Only possible locale for serbian latin is sr_YU, wich is cp1250! That is the reason I was talking about rewritting mosCurrentDate, that way I would bypass the server's (non)supported locales. If your site isn't on a windows server, you can't get unicode serbian latin. I try to avoid servers setting by calling predefined array of weekdays and months. Well, I think you know what I mean...
Logged
I've got a snap in my finger...
Got rhythm in my walk...
Print
Pages: [
1
]
« previous
next »
Elxis CMS Forum
»
Support
»
Language
(Moderator:
Farhad Sakhaei
) »
Rewritting mosCurrentDate