Page 1 of 1

r302 version update 1.4.1

Posted: Sat 31. Jan 2009, 14:09
by Jensensen
http://code.google.com/p/phpwcms/source/detail?r=302

Note that there are two new variables which should be added in the config file:

Code: Select all

$phpwcms['i18n_parse']             = 1; // enable|disable browser based language parser - all @@Text@@ will be parsed and checked for translation/var based replacement
$phpwcms['i18n_complex']     = 0; // enable|disable the way browser language setting should be used, false = the easier way (always 2 chars "en"), true - "en-gb"...
Have a look at: /config/phpwcms/dist.conf.inc.php


btw. phpwcms by now is v1.4.1

Re: r302 version update 1.4.1

Posted: Mon 2. Feb 2009, 16:23
by sustia
Hi, there is a small guide about the Internationalisation usage inside the r305?

Re: r302 version update 1.4.1

Posted: Thu 12. Feb 2009, 02:08
by update
This is great stuff!!!

Just wrap any text with @@ like so: @@my super text@@
you can use it wit alt tags for images, title tags for links, text within your content, within your templates....
Every time a user with a new (browser) language setting is hitting the site, a new file will be placed into /template/lemplate_lang like en-us.php, de-de.php. Now you only need to translate it:
$i18n_tokens['Land / Sprache wählen'] = 'Choose Country / Language';

As I've said before: great stuff :lol:

Re: r302 version update 1.4.1

Posted: Thu 12. Feb 2009, 02:21
by Jensensen
claus wrote:... wrap any text ...image ...
Really sounds GREAT! (so far i had no time left for testing. obviously you did?}
claus wrote:... Now you only need to translate it:
$i18n_tokens['Land / Sprache wählen'] = 'Choose Country / Language';
...
Where, what, how? Do you mean manually?
I thought, that the translation will happen automatically, isn't it???¿¿¿

Re: r302 version update 1.4.1

Posted: Thu 12. Feb 2009, 11:47
by update
)
Jensensen wrote:Where, what, how? Do you mean manually?
I thought, that the translation will happen automatically, isn't it???¿¿¿
You won't want to run a somehow babelfished site, would you? :mrgreen:
(nothing against that great babelfish!

Re: r302 version update 1.4.1

Posted: Thu 12. Feb 2009, 12:42
by sustia
claus wrote:This is great stuff!!!

Just wrap any text with @@ like so: @@my super text@@
you can use it wit alt tags for images, title tags for links, text within your content, within your templates....
Every time a user with a new (browser) language setting is hitting the site, a new file will be placed into /template/lemplate_lang like en-us.php, de-de.php. Now you only need to translate it:
$i18n_tokens['Land / Sprache wählen'] = 'Choose Country / Language';

As I've said before: great stuff :lol:
Hi, if I understand, all the phrases in my site that I would link to translate must be enclosed in @@my text@@, so when a new user come to my site (with, for example, an italian browser) a file (in this example, it-it.php) is created.

So now I must open the file, translate the text in italian and put this
$i18n_tokens['Land / Sprache wählen'] = 'Choose Country / Language';

and the new language is avalaible for the italian user (only with respect to the translated text, obviously).

It's correct?

Re: r302 version update 1.4.1

Posted: Thu 12. Feb 2009, 13:01
by update
Not exactly.
The newly created file (en-en.php) is already containing the line
$i18n_tokens['Land / Sprache wählen'] = Land / Sprache wählen';
Now you just translated it into
$i18n_tokens['Land / Sprache wählen'] = 'Choose Country / Language';
where ['Land / Sprache wählen'] would be your original @@Land / Sprache wählen@@
Everything else within this file has to be left untouched!

And of course in conf.inc.php:
$phpwcms['i18n_parse'] = 1; // enable|disable browser based language parser - all @@Text@@ will be parsed and checked for translation/var based replacement
$phpwcms['i18n_complex'] = 1; // enable|disable the way browser language setting should be used, false = the easier way (always 2 chars "en"), true - "en-gb"...

Re: r302 version update 1.4.1

Posted: Thu 12. Feb 2009, 13:30
by sustia
Hi claus, thanks for the answer.

I'm tried to modify the file it.php, but the ftp client say me
553 Can't open that file: Permission denied
because with a second browser (in spanish) I visited the page, but no es.php file is created. :?

Re: r302 version update 1.4.1

Posted: Thu 12. Feb 2009, 14:04
by update
Please check the file permission: is it 600 (-rw------, 644 (-rw-r--r--), 666 (-rw-rw-rw-) or what.
There is another thread running about file permission questions already

And check the preferred language setting for your browser tests - if a spanish browser has set english as a preference, no file for spanish will be generated...

Re: r302 version update 1.4.1

Posted: Thu 12. Feb 2009, 21:01
by update
At least one question (of many?) remains: How can I use this within a template? or a SHOW_CONTENT? This doesn't seem to work....

Re: r302 version update 1.4.1

Posted: Thu 12. Feb 2009, 22:02
by update
Hmmm...
this doesn't seem to work as cleanly as expected. Two images side by side, each with a title tag wrapped with @@ will produce unpredictable results picking up pieces of surrounding code like " />" and so on...
One single image is working fine.

Re: r302 version update 1.4.1

Posted: Thu 12. Feb 2009, 22:19
by update
Well - I've had an empty comment tag nearby in the template like so:
{some_rt}<!-- -->
where the content to be replaced was wrapped with @@
and it took these pieces of <!-- --> and mixed the into the file. This has happened with divs too.... I think Oliver should have a look into this one...

Re: r302 version update 1.4.1

Posted: Fri 13. Feb 2009, 09:11
by juergen
so claus,

you have this im one line or what ?

Re: r302 version update 1.4.1

Posted: Fri 13. Feb 2009, 16:02
by update
I have had it... but now I deleted it and everything seems to be fine. But it isn't meant to take over or collecting pieces of code from around... or?

Re: r302 version update 1.4.1

Posted: Sat 14. Feb 2009, 22:32
by update
so now this is working I wonder how to inject the right language tag into the doctype
$phpwcms['default_lang'] = 'de'; //default language
$phpwcms['DOCTYPE_LANG'] = ''; //by default same as $phpwcms['default_lang'], but can be injected by whatever you like
$phpwcms['allowed_lang'] = array('en', 'de', 'fr', 'it', 'es', 'be', 'pl'); //array of allowed languages
I would like to inject it automagically in dependance of the choosen (linked) language tree so there is no need to fiddle around with custom templates while doubling and tripling the needed templates. Anybody any idea how to achieve this?