HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


[v8.1.1] Issue with German LOCALE

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#88061 (In Topic #17886)
Avatar

Well-settled

Issue description: ocP translated into German. Date format works ok in English. Works almost ok in German, however some months seem to add an "i" to the end.

Example:

June (English), Juni (German) becomes Junii (German)
July (English), Juli (German) becomse Julii (German)

Not all months are affected.

I haven't found the root cause, I tried by adding

setlocale (LC_ALL, 'de_DE');

to info.php, but doesn't seem to resolve the issue.

So, I use the following workaround

File:

sources[_custom]/temporal.php


Replace

function locale_filter($ret)
{
    global $LOCALE_FILTER;
    if ($LOCALE_FILTER===NULL) make_locale_filter();
    foreach ($LOCALE_FILTER as $filter)
        if (count($filter)==2) $ret=str_replace($filter[0],$filter[1],$ret);
    return $ret;
}

With

function locale_filter($ret)
{
    global $LOCALE_FILTER;
    if ($LOCALE_FILTER===NULL) make_locale_filter();
    foreach ($LOCALE_FILTER as $filter)
        if (count($filter)==2) $ret=str_replace($filter[0],$filter[1],$ret);
    return str_replace(array('Junii','Julii'),array('Juni','Juli'),$ret);
}
Back to the top
 
Posted
Rating:
#88063
Avatar

Hi,

I'm not sure why locales sometimes do odd things like this, seems like a problem with however the server is serving the locale to PHP.

Anyway, you're fix is very close to what I'd say. Except, you don't need to modify the locale_filter function because this is what the function already does. You cab set the lang string:

Code

LOCALE_SUBST=Junii=Juni,Julii=Juli


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#88064
Avatar

Well-settled

Thanks Chris, this did the trick.

btw, I have run a php test script

date_default_timezone_set("Europe/Berlin");
setlocale (LC_ALL, 'de_DE.iso-8859-1');
echo strftime ("%A %e %B %Y", mktime (0, 0, 0, 6, 22, 2012));

which works pretty fine on the host. No weird month names here.

Nevertheless, with the LOCALE_SUBST I am fine.

Thanks.
Back to the top
 
Posted
Rating:
#88068
Avatar

Well this sure is strange :S.

'Junii' and 'Julii' are actually Latin.

I couldn't reproduce on my machine, which is a Mac. Are you on a Linux server? I'll see if I can work out why Latin is apparently being used.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#88069
Avatar

All I can think is if either:
  1. the locale wasn't set right.
  2. one of the date language strings wasn't set right.

Was the 'locale' language string set to 'de_DE.iso-8859-1'?

(On my Mac I had to use 'de_DE', but that's because annoyingly different systems use different names)

If the 'date_verbose_date' string had been set to something like 'date_verbose_date=%a %d %Bi %Y' that would cause it. The extra 'i' after '%B' would be interpreted literally.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Item has a rating of 5 (Liked by Chris Graham)  
Rating:
#88123
Avatar

Well-settled

Chris, thanks a lot for your investigation.

Finally, the answer to this issue is in LOCALE_SUBST.

I used:

January=Januar,February=Februar,March=März,April=April,May=Mai,June=Juni,July=Juli,
August=August,September=September,October=Oktober,November=November,
December=Dezember,Monday=Montag,Tuesday=Dienstag,Wednesday=Mittwoch,
Thursday=Donnerstag,Friday=Freitag,Saturday=Samstag,Sunday=Sonntag,
Mar=März,May=Mai,Jun=Juni,Jul=Juli,Oct=Okt,Dec=Dez,Mon=Mo,Tue=Di,Wed=Mi,
Thu=Do,Fri=Fr,Sat=Sa,Sun=So

It appears, that

...,June=Juni,...,Jun=Juni,...

replaces "Jun" twice, in the end we saw "Junii".

Another, simple example, would be:

...,June=Juni,...,un=eins,... would end in "Jeinsi" for month June.


So, translations are getting translated, too.


Last edit: by Ragtop
Back to the top
 
Posted
Item has a rating of 5 (Liked by sholzy)  
Rating:
#88125
Avatar

Funny that a translation mistake actually ended up progmatically generating Latin then :lol:. Ridiculum maximus.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: