View Full Version : Uppercase conversion in EE
perico
27th of December 2005 (Tue), 06:10
Hi everybody,
I've just installed the spanish language in EE (1.5 RC4) and so far so good, save for the fact that characters with accents in the language files are not converted to uppercase. I know this can be done for sure, since I've already seen these characters properly converted in some of the member's galleries.
I've searched the forum but I haven't been able to find anything on this issue; I would definitely appretiate if someone could point me out the solution to this problem.
Thanks in advance
jeronimo
27th of December 2005 (Tue), 16:31
In the page you want to change it search for
ee_translate_
And then A, B or C
Don't know exactly wich is wich, but by changing those you will find out.
MMCM
27th of December 2005 (Tue), 16:44
I removed all uppercase conversions from the source code because:
- I don't like to be shouted at by my EE gallery ;-)
- I didn't work for accented and umlaut characters
- It really looks stupid
- If I want something in uppercase I can change EXACTLY THAT item in the translation tables to uppercase
Take a look at http://www.photo-photo.at/
Martin
Pekka
27th of December 2005 (Tue), 17:28
Yes, easiest solution is to replace in fetchsettings.php contents of functions ee_translate_A and ee_translate_C with what you have in ee_translate_B so that those functions do not do any uppercase (ucfirst or strtoupper) conversion. So:
REPLACE
// translate A is for 'Upper caps initial'
function ee_translate_A ($string) {
if (is_array($string)) {
$text = @$string["text"];
$image = @$string["image"];
if ($image != "") {
$text = ee_translate_D($image,ee_html_conversion(ucfirst(s tripslashes($text))));
return $text;
} else
$text = ee_html_conversion(ucfirst(stripslashes($text)));
return $text;
}
else {
$text = ee_html_conversion(ucfirst(stripslashes($string))) ;
return $text;
}
}
// translate B is for 'as written'
function ee_translate_B ($string) {
if (is_array($string)) {
$text = @$string["text"];
$image = @$string["image"];
if ($image != "") {
$text = ee_translate_D($image,ee_html_conversion(stripslas hes($text)));
return $text;
} else
$text = ee_html_conversion(stripslashes($text));
return $text;
}
else {
$text = ee_html_conversion(stripslashes($string));
return $text;
}
}
// translate C is for 'ALL UPPER CAPS'
function ee_translate_C ($string) {
if (is_array($string)) {
$text = @$string["text"];
$image = @$string["image"];
if ($image != "") {
$text = ee_translate_D($image,ee_html_conversion(strtouppe r(stripslashes($text))));
return $text;
} else
$text = ee_html_conversion(strtoupper(stripslashes($text)) );
return $text;
}
else {
$text = ee_html_conversion(strtoupper(stripslashes($string )));
return $text;
}
}
WITH
// translate A is for 'Upper caps initial'
function ee_translate_A ($string) {
if (is_array($string)) {
$text = @$string["text"];
$image = @$string["image"];
if ($image != "") {
$text = ee_translate_D($image,ee_html_conversion(stripslas hes($text)));
return $text;
} else
$text = ee_html_conversion(stripslashes($text));
return $text;
}
else {
$text = ee_html_conversion(stripslashes($string));
return $text;
}
}
// translate B is for 'as written'
function ee_translate_B ($string) {
if (is_array($string)) {
$text = @$string["text"];
$image = @$string["image"];
if ($image != "") {
$text = ee_translate_D($image,ee_html_conversion(stripslas hes($text)));
return $text;
} else
$text = ee_html_conversion(stripslashes($text));
return $text;
}
else {
$text = ee_html_conversion(stripslashes($string));
return $text;
}
}
// translate C is for 'ALL UPPER CAPS'
function ee_translate_C ($string) {
if (is_array($string)) {
$text = @$string["text"];
$image = @$string["image"];
if ($image != "") {
$text = ee_translate_D($image,ee_html_conversion(stripslas hes($text)));
return $text;
} else
$text = ee_html_conversion(stripslashes($text));
return $text;
}
else {
$text = ee_html_conversion(stripslashes($string));
return $text;
}
}
perico
28th of December 2005 (Wed), 02:36
Thanks everybody, particularly to Jeronimo and Pekka for pointing me to the place where the conversion takes place.
Once I knew which function was "the culprit", I figured out that you can leave the code as it is and solve the problem by adding the line:
setlocale (LC_CTYPE , "spanish");
to the global.php file of the spanish language.
(Replacing setlocale(LC_TIME, "spanish") with setlocale(LC_ALL, "spanish") would work as well, but I'm not sure if that would have undesired side effects. I preferred to touch as little as possible)
Pekka, I understand that you are currently maintaining the language files; you may consider adding this line to the spanish file (and probably the corresponding one to other languages as well). I've tried this and it works, but double check it in any case since I'm not an expert in php.
As I said, thank you guys for the quick response. Let me add that I am new to EE but I find it an excellent program. I am moving all my photos to EE and I am looking forward to the promised new version.
vBulletin® v3.6.12, Copyright ©2000-2012, Jelsoft Enterprises Ltd.