Page parts and multilingual sites?

Feed 28 posts, 11 voices

Avatar
1493 posts

I am ONLY curious -- this just occurred to me, and I thought I would see what the hard-core coders would think...

Would it be possible to use page.parts to structure a bi- or multilingual site? You wouldn't want to replicate your page/subpage structure, I would guess.

You could have your "default" language in the "body" part of the page, then create a "de" or "fr" or "ro" or "nl" or "sv" or whatever, tab with the text in that corresponding language. Then you could set a variable ... somehow :), which would allow you to do something like this in your template:

if (language variable set to X value),
    then (echo the X tab content)
otherwise (give me the default)

Does that make any sense? I know Philippe has a big French/English site, but I don't know how it is managed/structured.

As I say, this is for NO urgent need. I'm only curious, but others might be interested in the question, too.

 
Avatar
651 posts

I’ve also been wondering about how we would do this… apart from the technical side, I think there are some questions we should answer regarding the requirements:

  1. Do we want to automatically fall back to the “standard” language of the site in case there is no translated version of a page?
  2. Do we want the translated version of the site to be more or less independent? (i.e. if we don’t fall back like in item 1, just display a 404)
  3. How do we determine which language to display to the user?

Especially the last question….

  • Do we ask the browser? (which usually transmits possible and preferred languages in the HTTP header.. if it doesn’t we can fall back to english or the site’s default language)
  • Do we simply provide links from the default language page to translated pages? (i.e. the user CAN click on them but we don’t force it)
  • Do we put a language selector in the URL and use that? (i.e. http://www.example.com/page.html would be the default language and http://www.example.com/nl/page.html would be the Dutch language version of the page)
  • The last one would be nice, but how would we then determine whether or not the /nl/ bit is simply part of the pages/menu structure of the site or a language indicator?

Things to ponder… ;-)

 
Avatar
51 posts

I think it would be important to have the language culture in the url for search engine.

I like the idea to "fall back" to the default language if the content in the current language is not found.

But I think we need a better solution than simply add part with the name of the language.

 
Avatar
1493 posts

@gido - "But I think we need a better solution than simply add part with the name of the language."

Isn't the alternative to replicate an entire site's structure, though? You would have an entire "en" branch and have that all duplicated with a "fr" branch? Hmmm....

Just for interest's sake, this is a Frog site running in French and English. I don't know how it is set up!

 
Avatar
651 posts

@david - "Just for interest's sake, this is a Frog site running in French and English. I don't know how it is set up!"

I think this is a site that simply has it's entire site structure duplicated. When I look at the URL, it looks like they made two hidden pages beneath Home: "en" and "fr". They then probably added language specific pages beneath that...

That works, but it is very labor intensive from the content editor's perspective I think.

@gido & @david - I think translation can be done in two ways:

  1. We write a plugin/helper/functionality of some kind which translates a page with the help of for example Google translate or another such site.
  2. We allow the content editor(s) to provide their own translations.

When I look at sites like Google's Translate, I see they translate content into the biggest nonsense there is. I personally would never want to automatically translate a page on my site.

I feel option 2 is the way to go... assuming you both agree, the next question is: how can we keep it as simple as possible for both content editors and site administrators?

Simply duplicating the site structure like I specified in the beginning would be simple enough, but would be prone to errors and labor intensive.

For now, I prefer the "part part" idea. However, maybe we shouldn't use page parts but introduce "translation parts" for lack of a better term?

 
Avatar
486 posts

I think it's a good idea to use Parts as David suggested in conjunction with a language selector in the URL like mvdkleijn suggested. lang=en at the end...

 
Avatar
651 posts

I'd prefer not using something like "lang=en" at the end since that would mess up our URL structure.

I'm going to see if the W3C provides any specs on this...

 
Avatar
486 posts

though when you use the selector it can be weird too because your page would look like site.com/aboutus/fr

for example, but why should the URL say 'aboutus' which is english, instead of the equivalent in french?

 
Avatar
51 posts

@David, thanks for the link. I'm happy to see that frog can manage a large site.

@mvdkleijn - We write a plugin/helper/functionality of some kind which translates a page with the help of for example Google translate or another such site.

No, I never intented to translate pages with an automatic system :) I strongly dissuade this practice to you.

I'm thinking about multilingual content and frog integration. Actually the best way to do this is to create several "branch" (one for each language) and duplicate the site structure.

The problem of using "translation part" is that we can't translate the pages titles or meta-data.

 
Avatar
1493 posts

gido said: "The problem of using "translation part" is that we can't translate the pages titles or meta-data."

That is a very good point... Hmm.....

It just seems that duplicating the site structure is quite labour-intensive, and harder work for editors/content providers. Not an easy issue to solve simply, elegantly, easily!! O_o

 
Avatar
651 posts

@gido - there is no readon why we can't introduce a "translated-title" field into a "translation-part".

Anyway, I've looked at several recommendations and standards from the W3C and other sources. In essence, there is no provision for a language selector in the URI. I've come across one example, which when we change that to Frog style would give us:

    http://www.example.com/this-is-a-page.html
    http://www.example.com/this-is-a-page_fr.html
    http://www.example.com/this-is-a-page_en.html

For the default, french and english versions of that page respectively.

This scheme could work for us but that yields another problem... both the dash ('-') and underscore ('_') characters are valid characters in Frog page URLs. To make sure our "language selector" works, we'd have to disallow the use of underscore in page title URLs.

I personally don't have a problem with disallowing underscores in Frog page URLs

On another point, it turns out that non-ascii characters in URLs are illegal, at least in HTML4. I couldn't find a reference on this particular topic for XHTML but there are almost no changes between HTML4 and XHTML on URLs, so my guess is that it is also illegal for XHTML.

This means the URL below would be considered illegal since these characters would have to be escaped. (turn them into things like თ)

    http://www.example.com/page-with-utf8-subpage/こんにちは世界.html

What do you guys think? Simply ignore the standard and support it or drop support since it is non-standard?

 
Avatar
651 posts

the escape character should have been like below but without the spaces:

  & # 4311 ;
 
Avatar
18 posts

Creating a multilanguage site can easily be done with frog.

You can create a kind of homepage where user choose there language and enter you’re website. This can be done under the home page. Then you create the directory/pages for your languages like this:

Homepage
 - English
  - English version of the website.
 - Dutch
  - Dutch version of the website.
 - French
  - Frech version of the website.
 - even more languages...

In your template/layout you can add something like this:

<a href="<?php echo $this->content('EN_TranslationUrl', true); ?>">EN</a> (for english translation)
<a href="<?php echo $this->content('NL_TranslationUrl', true); ?>">NL</a> (for Dutch translation)
<a href="<?php echo $this->content('FR_TranslationUrl', true); ?>">NL</a> (for french translation)
and so on...

When creating a page with that layout add the following tabs: EN_TranslationUrl, NL_TranslationUrl, FR_TranslationUrl, …

In those tabs fill in the url to the translated page. In this way you can use whatever URL you want.

It’s a quick work around for the multilanguage site problem.
I agree there should be a solution in the Frog CMS where it would be a lot easier to create a translation for a page.

I sometimes use typo3 to create a website and there you can just create a translated version of the content on a certain page… The rest is automatically done for you…

I tried to explain everything the best I could (I’m not so good at explaining things), if you don’t understand what I mean, just ask and I will try to explain…

 
Avatar
651 posts

I just noticed that W3C uses the convention below… I think this would probably work well with Frog and its “parts” system.

http://www.example.com/somedir/somepage.en.html
http://www.example.com/somedir/somepage.nl.html
http://www.example.com/somedir/somepage.fr.html

The default page (http://www.example.com/somedir/somepage.html) could then simply become a redirect to the default language.

What do you guys think about that?

 
Avatar
486 posts

  1. Do we put a language selector in the URL and use that? (i.e. http://www.example.com/page.html would be the default language and http://www.example.com/nl/page.html would be the Dutch language version of the page)
  2. The last one would be nice, but how would we then determine whether or not the /nl/ bit is simply part of the pages/menu structure of the site or a language indicator?

Can’t we just use mod_rewrite? If someone turns on multilanguage via a setting in admin or whatever, then we can make the first url section after the domain the language indicator. Would that work?

 
Avatar
651 posts

@ricks – but it would mean that we couldn’t use both at the same time… i.e. if someone goes to

www.example.com/this-is-a-test.html

when the multilanguage feature is turned on, in you case, they would (hopefully?) get a 404. I’d actually prefer them getting the site’s default language.

I think I’m slowly gaining preference for something like “.nl.html” or “_nl.html” for the language indicator.

Though I’ve been talking to Philippe about this and we feel that simply being able to copy-paste (parts of) the entire site structure might be enough?

 
Avatar
486 posts

@ricks – but it would mean that we couldn’t use both at the same time… i.e. if someone goes to www.example.com/this-is-a-test.html

Maybe I don’t understand mod_rewrite very well, but how come we can’t just redirect to www.example.com/en/this-is-a-test.html?

If the multilanguage feature is turned on, the rewrite rule will be looking for url.com/language/somethingeles. In other words it will look for two slashes.

If there’s only one slash in the URL, why can’t it redirect that to the default language?

Maybe I’m missing something here, but from first appearances to me it looks like this problem might be solved with a proper regex and rewrite…

 
Avatar
541 posts

just to answer some old question about the interfaces montreal website structure !!

it is really simple

you have:

/ <- here is the redirect to en or fr depending on your browser preference
  /fr
      /page1
      /a-propos
      / ...
  /en
      /page1
      /about
      / ...

that’s it !!

 
Avatar
180 posts

philippe, we use this idea. it’s simple. Especially as a structure of linguistic versions can be different.

 
Avatar
651 posts

now imagine a site with 100 pages and 3 languages… :-)

 
Avatar
180 posts

300 pages. And what the problem?

 
Avatar
1493 posts

jMas wrote:

300 pages. And what the problem?

Well, not so much a problem as (potentially) a lot more work. If you could have just one directory tree with a means of auto-detecting language-specific content, that would make site maintenance and page creation much simpler. Wouldn’t it?

 
Avatar
651 posts

@David – Correct

@jMas – It is the combination of 300 pages and 3 language… which mean you would have to create 300 * 3 = 900 pages to create.

You could create them manually or fiddle with the DB.

At least in this version of Frog.

 
Avatar
4 posts

i think each language should have its own tree. the root-page in frog
could be a language-redirect bahaving page (redirects to a language-version
according to browser-settings or the default-language, see language-redirect
for radiant-cms).

this has different advantages:

  • no parts-mess (think of a 3-part layout x n-languages…)
  • translated urls (no ‘englishpagename_fr’-thing)

maybe frog should have a tree-copy/move functionality as it exists for radiant-cms
as a plugin?

language-redirect: https://svn1.hosted-projects.com/medlar/language_redirect_extension/language_redirect/
copy-move: http://gravityblast.com/projects/radiant-copymove-extension/

what do you think?

 
Avatar
18 posts

I agree with fpauser. frog should have a tree-copy/move functionality. I would make some task a lot easier and also in the current version of frog, it would help maintain a multiple language site.