1 heppy May 15, 2006 15:03
3 heppy May 15, 2006 16:40
EdB wrote:
My understanding is that the multilingual thing is for 'stock' text in b2evolution to show up in the language of the user. The actual post will show up in whatever language it is written in. The idea, if I understand correctly, is that you can blog in German (for example) and all your German visitors will see all the text in German instead of just your post.
It does not translate your actual posts into different languages. For that you would have to actually write two posts, though there may be some cool methods that accomplish this for you. If so they are not native to b2evolution.
thanks for that, i think it answe4red my question, but i didn't want it to translate automatically, just that i would write the post once in english and once in italian, then when the user arrives at the front page they choose the language, which is remembered in a cookie or something. So that in reality there are 2 entries for each posts, with only one viewd at a time.
Perhaps making a hack to use the same system that the 'stock' text uses to display the correct language....
But as i said i think you answered it anyway.
4 edb May 15, 2006 16:45
The stock text is translated in advance, and is triggered by having the text in a little code snippet.
<?php echo T_('this is stock text') ?>
Kinda hard to do that for everything you might post eh?
I think the only hack you need is to cookie the language selection, but you might be able to easily work around that. Suppose blog 2 was English and blog 3 was the English linkblog, then blogs 4 and 5 were the Italian version. You would end up posting twice, but your visitor simply picks (and bookmarks or aggregates) the blog in the language they like.
5 yabba May 15, 2006 17:23
Here's how I'd achieve it (going to be using a similar method on a site where I need multiple "views" of the same info)
1/ create your posts with both content
<div class="content1"><!-- content 1 --></div>
<div class="content2"><!-- content 2 --></div>
2/ Create the skin you want to use and in the style sheet add
.content2{display:none}
3/ create a copy of your skin in 2nd folder and add this line instead
.content1{display:none}
4/ Allow skin switching on your site
¥
6 topanga May 15, 2006 18:32
Yabba : this sounds to good to be true.. (I haven't tried it yet)
In Belgium we have that problem all the time, because everything is allways in two languages.. (especially at my company)
But because the 'stock-text' also has to change, I don't think this works.
Stock text is dependable of the language of the post and the language of the blog.
I suppose what Heppy wants is exactly the same as I do.
That means that if you see your post in Italian, all stocktext has to be italian also the 'leave a comment' and stuff..
Changing the skin won't be enough...
7 yabba May 15, 2006 18:41
lol, damn, that's gonna take a smidge of thought ( I only need variations of english)
You can probably "kid" the skin by temporarily setting the blog/post/comments/etc language ..... but I'd have to wander off and have a look at the files to be sure of that.
If not then I'm afraid you're pretty much restricted to using two blogs as EdB suggested and keeping all the cats etc in synch.
[offtopic ish]
To be honest, I'm still confused why all the buttons/text for standard stuff is based on the blog/post/whatever language, surely it'd be more logical to display them in the visitors language, after all, they're the ones that are reading it?
[/offtopic ish]
¥
8 topanga May 15, 2006 20:20
¥åßßå wrote:
To be honest, I'm still confused why all the buttons/text for standard stuff is based on the blog/post/whatever language, surely it'd be more logical to display them in the visitors language, after all, they're the ones that are reading it?
I follow you 100%
I suppose that if you don't live in switserland or belgium, no programmer even thinks of these multi-language questions.
For us (belgians) it's so basic that, even with two users, you have two languages..
At this moment I have two blogs and that means also two posts.
I use the "link" field to put in the url of the post in the other language.
But this has the disadvantage that you realy have two posts, and that the one has nothing to do with the other.
To make thinks more complecate, in our company the rule is that everybody can speak his own language (bottom up) and has the right to read stuff that comes from the company (top down) in his own language.
Thats why we have posts in 2 languages, and comments in the language of the commenter (so two languages mixed up).
Since this is the only way to go, I see clearly that this way is far to mutch away from the standard way b2evo is set up.
9 heppy May 16, 2006 00:04
I'm sure it couldn't be too difficult to manage, perhaps in Pheonix something like this would be made simpler.
I saw somewhere i think in the CVS something with <lang:eng> within a post, or generated xml. Still trying to find it again, but i'm not sure what it referred to.
10 stk May 16, 2006 02:15
I'm not very multi-lingual, though I have learned to interpret the pseudo-babbling of a 2 year old, but there is this thought ...
b2evo is multi-lingual in the sense that the user selects what their language is ... then all of the buttons and commands pull from the translation file for that language.
I like ¥åßßå's idea for CONTENT, but for the controls and buttons, couldn't there be a system setting override that temporarily changed the blog language, so that not only was the content changed, but also the buttons, explanations, etc?
The language file is THERE ... seems to me that there must be a way to take advantage of that.
Hope this helps.
11 yabba May 16, 2006 09:38
Ok, this may or may not work :-
skins/<skin_name>/_main.php find & comment out these two lines :-
locale_temp_switch( $Item->locale ); // Temporarily switch to post locale
locale_restore_previous(); // Restore previous locale (Blog locale)
Then add these bits :-
<body>
<?php
$temp_lang = $_SERVER[ 'HTTP_ACCEPT_LANGUAGE' ];
$temp_lang = substr( $temp_lang, 0, strpos( $temp_lang, ',' ) );
locale_temp_switch( $temp_lang ); // Temporarily switch to post locale
?>
<?php
locale_restore_previous(); // Restore previous locale (Blog locale)
?>
</body>
</html>
To ensure that your posts can be read correctly you need to change the divs that you use a smidge
<div class="content1" lang="<content1 lang>"><!-- content 1--></div>
<div class="content2" lang="<content2 lang>"><!-- content 2--></div>
Hit save and cross your fingers ;)
¥
12 annerle Jun 01, 2006 02:07
Hi,
Sorry, I am not sure if I got everything right. I have do make all the changes in main.php?
And then when writing my comments I put them within the different div tags?
Just wanted to make sure before starting to change anything.
Thanks
13 yabba Jun 01, 2006 10:46
The changes to _main.php are untested (I'm waiting for Topanga to get back off holiday and try it), so I don't know for certain if they will work as expected, but it's not a hard one to undo if it doesn't work ;)
The rest of it will work as expected, but use the latter version of the div tags :-
<div class="content1" lang="<content1 lang>"><!-- content 1--></div>
<div class="content2" lang="<content2 lang>"><!-- content 2--></div>
¥
14 annerle Jun 01, 2006 17:33
hi!
ok, I tried it, it worked nicely for the contents and even titles but not for changing the "normal" text like categories, comments,.....
however, you can probably change this in the skin as you are using two different skins anyway. that's maybe not an elegant way of solving this problem, but .... I would not know what else to change. especially as the title of the blog will probably also need to be changed...
a BIG THANKS to Yabba.
Cheers, Anne
15 yabba Jun 01, 2006 17:40
Can you point me to the blog where you've tried it? I might be able to come up with a method that includes the rest of the bits.
¥
16 yabba Jun 01, 2006 19:10
Hi Ann,
In reply to your pm, you need to comment out these two lines in your _main.php
line90 locale_temp_switch( $Item->locale ); // Temporarily switch to post locale
&
line 131 locale_restore_previous(); // Restore previous locale (Blog locale)
(to comment them out just put )
//locale_temp_switch( $Item->locale ); // Temporarily switch to post locale
&
//locale_restore_previous(); // Restore previous locale (Blog locale)
Otherwise the blog post languge overrides the skin langage.
I'm guessing that your post flags will change if you do that, if they do then change this line (approx 102) :-
locale_flag( $Item->locale, 'h10px' );
to :-
locale_temp_switch( $Item->locale ); // Temporarily switch to post locale
locale_flag( $Item->locale, 'h10px' );
locale_restore_previous(); // Restore previous locale (visitors locale)
¥
17 annerle Jun 02, 2006 02:05
morning!
Still not working. :-/
As I understood the code the language variable is coming from mysql, as you define it with your post or for your blog. Couldn't you just define both variables it at the begin of the main.php or whenever they are first called by the values given from mysql?
So you would need to define
blog_locale
and
post_locale
to the language you want.
I think they are never really defined as being - in my case - german (de-DE) or english (en-UK). I am using a language definition in the div tag but that is called after the blog variables have all been defined by mysql and is used to switch between my posts. So changinge blog_locale and post_locale to de-DE in the german skin and to en-UK in the english skin.
I have yet not found where these variables are called the first time. I might find the time to try it today. If somebody is willing to point me to the right direction - thanks, that would save quite some time.
a.
18 yabba Jun 02, 2006 09:58
Morning ;)
I just switched languages on my browser and it appears to work for me?
What happens is that all of the "read more" "comments" "permalink" etc should be displayed in the language of the visitor (not the language of the blog/post) and the post should be displayed in the "skin" language.
¥
19 annerle Jun 02, 2006 16:40
hi!
yeah IE I know, :roll:
it worked with the english-uk but not with the english-american! ever tried that one?
greetings from singapore!
20 edb Jun 02, 2006 18:11
For text there is no difference between ANY of the "english" languages. The only differences are how dates and times are displayed. I think 1.6 is the first time the "start of week" day was set by the language, but it's possible it happened back in the .9.1 days. Thus you'd have to look very carefully to see if you are getting the UK version or the US version of "english".
21 topanga Jun 06, 2006 13:01
The things like xx words, 1 comment,.. are still in the language of the blog. They don't follow the langue of the skin.
22 yabba Jun 06, 2006 13:05
They should be in your browser language, not the blogs (or skins) language.
Do you have a link to where you've set this up?
¥
23 topanga Jun 06, 2006 13:58
euh.. we all have an english browser...
the language of our software, nor our pc is the language we speak...
So the language should change if I do a language switch (ie I change skin)
For the moment I have no public version of it, I'll work on it as we speak
24 yabba Jun 06, 2006 14:03
Ahhh, in that case, change this bit of code :-
$temp_lang = $_SERVER[ 'HTTP_ACCEPT_LANGUAGE' ];
$temp_lang = substr( $temp_lang, 0, strpos( $temp_lang, ',' ) );
locale_temp_switch( $temp_lang ); // Temporarily switch to post locale
to :-
locale_temp_switch( '<desired locale>' ); // Temporarily switch to skin locale
¥
25 topanga Jun 06, 2006 14:16
That works (offcourse)...
26 yabba Jun 06, 2006 20:01
cool :D .... remind me to tell you how to make it all one skin ;)
¥
27 topanga Jun 06, 2006 20:50
¥åßßå wrote:
cool :D .... remind me to tell you how to make it all one skin
please do... :)
28 yabba Jun 06, 2006 21:39
lol, ok, remind me to put this into (understandable) english when I sober up :p
1/create a new folder for other other skin (2nd language)
2/in that folder create a _main.php with :-
<?php
$skin_language = '<whatever>';
require_once dirname(__FILE__).'/../<real skin name>/rest_of_skin.php';
?>
3/ rename (normal skin) _main.php to rest_of skin.php
4/ create a _main.php (normal skin) with :-
<?php
$skin_language = '<whatever>';
require_once dirname(__FILE__).'/rest_of_skin.php';
?>
5/ change locale_temp_switch( '<desired locale>' ); // Temporarily switch to skin locale to locale_temp_switch($skin_language ); // Temporarily switch to skin locale
ish :p
tad more to it than that, but EdB keeps plying me with whiskey when my backs turned, so holler if you get stuck ;)
¥
29 pepoluan Feb 15, 2008 00:01
So.
Any new development on the "multilingual" capability?
Oh, btw I'm using b2evolution-2.4.0
30 topanga Feb 15, 2008 07:44
pepoluan wrote:
So.
Any new development on the "multilingual" capability?
Oh, btw I'm using b2evolution-2.4.0
Not that I know of.
My understanding is that the multilingual thing is for 'stock' text in b2evolution to show up in the language of the user. The actual post will show up in whatever language it is written in. The idea, if I understand correctly, is that you can blog in German (for example) and all your German visitors will see all the text in German instead of just your post.
It does not translate your actual posts into different languages. For that you would have to actually write two posts, though there may be some cool methods that accomplish this for you. If so they are not native to b2evolution.