71
Daigoro
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2004/2/22 12:37

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


Hi Chris,

I know it's a long time since you were hacking around with setlocale(), but I'd like to understand your problems better as I'm currently hacking to make an "easy install" Multilingual hack pack for 2.0.6.

I'm hosting a multilingual site myself. It features danish, japanese and english. All of these languages uses a different system for displaying dates etc. I've setup the way it should be displayed in the following three files:
/language/japanese/global.php
/language/english/global.php
/language/danish/global.php

I'm yet to find a place on my site, where this don't work.

Could you please clerify exactly why the hack is needed, and if you have improved on it.

72
Daigoro
Multilingual problem with pre-generated file: /cache/adminmenu.php
  • 2004/2/23 1:38

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


Hi,

Running on a multilingual site, with three selectable languages, I've had a problem with the popups in the admin menu.
The problem is that the popups will be shown in one of the three selected languages, but not nessary the selected language.
Eg. if I have selected to see the site in english, then the popups might be shown in japanese, danish or english.

This evening I found out why:
The popups are located in /cache/adminmenu.php and this file is generated when changes to the modules happens. The language of the popups will be the language at the time of the file-generation.

Natually this isn't any good, so I'm wondering how to to one of the following two thngs:

1) Don't use /cache/adminmenu.php
- This sounds easy, but appears to be pretty hard to do.

2) Generate a /cache/adminmenu_language.php for each language.
- This sounds difficult, but I belive it's the best way to do it.

However, I can't figure out how to do it.

Any help is appriciated.


Best regards,

73
Chado
Re: Multilingual problem with pre-generated file: /cache/adminmenu.php
  • 2004/2/23 2:01

  • Chado

  • Not too shy to talk

  • Posts: 113

  • Since: 2003/6/6 7


Quote:

Daigoro wrote:
I've had a problem with the popups in the admin menu.
The problem is that the popups will be shown in one of the three selected languages, but not nessary the selected language.


Hello Daigoro!
I have wondered about that myself. Just a quick thought here...If you are the only one really working with the admin side, how about just replacing all the Japanese admin.php files with the danish ones. That way, the admin side will always be Danish. I haven't tried it, it just seems easier - a quick cut and paste.
Chad

74
ibzan
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2004/2/23 10:42

  • ibzan

  • Just popping in

  • Posts: 48

  • Since: 2003/8/31


I dumped my idea of using the set_Local function and simply stuck with the date() tag. This actually made things more simple as none of the global files had to be changed.

This still wouldn't solve the problem, though, with different languages and the way dates are displayed, as in the US we do month-day-year whereas I needed for russian to display day-month-year. Obviously making changes to the global file would address this however because of the languages of Russian, for example, the word for the month is changed to reflect how it is being declined (i.e. it's case).

So I wrote a simple hack and called it into the header.php file (include XOOPS_ROOT_PATH.'/your_path/your_file_name.php';)

Within this file I start by setting a variable for the date (from what's coded in the global file so to be language friendly) ... well it may be a little easier to just give an example. I'll just simplify this by only using the months of January and February to allow you to see how it works:

Quote:
<?php
$mydate = date (_MYDATEFORMAT);
$patterns[1] = "/January/";
$patterns[2] = "/February/";
$replacements[1] = "января";
$replacements[2] = "февраля";
ksort($patterns);
ksort($replacements);
$mynewdate = preg_replace($patterns, $replacements, $mydate);
$xoopsTpl->assign('rus_date' , $mynewdate);
$xoopsTpl->assign('eng_date' , $mydate);


Essentially begin with the date - from there set an array of patterns for the function "ksort" to look for. (I have not only months but also days of the week coded).

Second define an array of replacements that will take the place of the pattern which was defined. In this case I want the English word January to be replaced with the Russian -- note: set_local did this but as I mentinoed did not change the endings correctly.

Third when your arrays are set, have ksort basically sort your patterns with your replacements (i.e. replacement[1] replaces pattern[1] and so on) then create your new variable and use preg_replace do the work of replacing what you earlier defined.

This left me with two date variables, one unique for English readers and the other for Russian. When a person selects their preferred language the proper date is shown (via an if statement in the theme - if the language is English show this, if not then this...)

Does that make sence? I am sure that you can accomplish the very same thing in a tri-lingual environment. For each language you will have to repeat this process. Like if I were to add another language, then I'd have English as my control group (or Russian or any other for that matter - it is just easier in English as the date() function returns English...) The first array, etc., would changing English into Russian, the second from English in to the third, and so on...

I hope this helps.

Blessings,

Chris

75
Vargr
Re: Multilingual problem with pre-generated file: /cache/adminmenu.php
  • 2004/2/23 11:31

  • Vargr

  • Not too shy to talk

  • Posts: 130

  • Since: 2003/6/19


@ Chado:

(I am the co-webmaster of the site Daigoro mentioned.)

You are absolutely right, that would solve the problem here and now since we are only two webmasters and we both speak Danish and English, whereas Japanese is a little more difficult.

However, since we run the website for an association, we might have Japanese or English speaking co-webmasters or at least moderators at a later state, who would need access "behind the scenes" so to speak.

And we would really like a clean and well-founded multilingual solution, that evt. will be useable by anyone running a multilingual site.



76
Daigoro
Re: Multilingual problem with pre-generated file: /cache/adminmenu.php
  • 2004/2/23 13:27

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


Chado,

At the moment only danes are working with this site, but it will change. Also, for compleateness of the Multilingual hack, it would be best if it was generated on the fly, or one for every language.

Regards,

77
Daigoro
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2004/2/23 13:34

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


Chris,

Okay, now I understand...
But this isn't realy related to the multilingual hack. It's a direct limitation of the XOOPS system, and should be handled in a non-hacked one language system.

Xoops core programmers should be informed of this shortcomming, and fix it, as it should clearly be part of the global.php file.

Best regards,

78
ibzan
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2004/2/24 7:01

  • ibzan

  • Just popping in

  • Posts: 48

  • Since: 2003/8/31


Quote:
Okay, now I understand...
But this isn't realy related to the multilingual hack. It's a direct limitation of the XOOPS system, and should be handled in a non-hacked one language system.


I don't know if this is simply a limitation, as you put it, with XOOPS or if really the problem lies withing PHP itself. However you are correct, this is a workaround.

If, for example, the issue is with PHP, then (I think?!?) the XOOPS core could take that into consideration - but as if it isn't their fault, then this too would only be a work around. (When I say issue I mean when dates not formatting as they should for a particular local - neither the date() function nor set_local() deal with this correctly).

I've coded a blank page (that is 100% outside of Xoops) to display dates and the same problem arose - my dates in Russian were not properly declined. I don't know enough to be certain, however XOOPS doesn't appear to be the culprate...

blessings,

Chris

79
Daigoro
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2004/2/24 15:33

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


Chris,

Since the words you replace are part of the global.php, then it should be possible to have XOOPS do it correct.

I spoke to a Russian colague of mine, and he explained that for months there are at least two ways of writing those. The "December" in "1. December" and "2. December" will have different endings.
Also for day names, there are atleast six ways of writing those.
The date-routine within the xoops-core should be able to find out which of these spellings to use. And all of the spellings should be part of the global.php file.


In other languages there are other requirements. I was told that Africaans uses different spelling of month and day names weather they are in the future, today or in the past. Again, the date-routine within the xoops-core should be able to find out which of these spellings to use.


I've asked my Russian colague to try to explain the rules to me, but that won't be before the middle of next week.

Best regards,

80
benell
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2004/2/25 16:44

  • benell

  • Just popping in

  • Posts: 63

  • Since: 2003/12/7


what is the status of this? im holding my site off until i can use multi language in xoops2.06

Login

Who's Online

176 user(s) are online (131 user(s) are browsing Support Forums)


Members: 0


Guests: 176


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits