Bill

ideas for switching to a different language version of a site

Vote 0 Votes

I have a website in the Thai language and I have been requested to mirror that site in English. The site would be a 1 to 1 copy of the original. Every Page and Entry would have a corresponding Page or Entry on the English site. I have been asked if there is a way to put a Thai/English toggle link that would allow me to switch to the same page on the corresponding site.

Is something like this possible with MT tags in my template headers? I'm not sure where to begin on this one.

Reported on Movable Type 4.3

11 Replies

| Add a Reply
  • Hi Bill,

    I've just gave instructions on how to reach this goal to another forum member.

    Check this out:
    http://forums.movabletype.org/2012/07/download-liks-from-other-blog.html

    Kind Regards,
    Mihai Bocsaru

    ----------------------------------
    Daily Movable Type Consultant

    Web Development
    Movable Type Consulting
    Six Apart Partner

    http://www.pro-it-service.com/
    ----------------------------------

    Movable Type Demo
    http://www.movabletypedemo.org/

  • @qulina: I fail to see how (not subtly) telling Bill to switch to Drupal is 1) goign to help him and 2) a constructive comment in a forum dedicated to Movable Type.

    Bill, here's how I do it on my own site with MT: use the language negotiation capability of browsers and the web server (Apache in my case, here's the feature in detail). The process works as follows
    - setup each site to produce files that end with .html.LANG where LANG is the ISO country code (.fr for my French site and .en for the English one)
    - make sure the sites templates are outputing pages exactly in the same place on the server. this means index.html.en and index.html.fr, or /folder/mypage.hml.en and /folder/mypage.html.fr are produced next to each other on the server document root
    - make sure that all corresponding pages share the same "slug" in the URL, i.e. they have the same basename in the two sites.
    - configure your web server to handle language negotiation. For Apache, the instructions are in the link I provided above).
    - optionally you can provide a simple link to switch language, using a cookie, if your web server also knows how to handle that. For Apache, it's explained on the same page under "Language Negotiation Exceptions".

    If you want to see it live (and study the code for the language switch via cookie), you can check http://ubiquitic.com/ - If your browser language preference is set to anything but French, you should see any page in English. If you set ti in French, you'll see them in French.

    The advantage of this system is that all your pages can have exactly the same URL, because you do not need to expose the ".LANG" part of it. This means that I can send people to my home page with the URL above (or any other, really), without thinking about the language (they'll get what they prefer).
    The only caveat I see with this solution is a potential drawback in SEO (meaning that the language in which you chose to write the basenames will be reflected in the URLs, but I don't know how much weight search engines place in URLs). But many big sites have URLs written in English even so the pages language isn't, so reckon it's a small issue.

  • Hey Bill -- I recently built a custom field specifically for this purpose: the Reciprocal Entry Association (and Reciprocal Page Association) fields that are part of the More Custom Fields plugin.

    The field is used to link two entries together, and a popup entry picker lets the author easily find which entries they want linked together. When editing Entry A and linking to Entry B, an association from Entry B back to Entry A is automatically created. When deleting an association, the reciprocal is also removed. The best part: on the Edit Entry screen is a link to edit the reciprocal Entry, allowing authors to easily jump between Entries.

    The advantage of this system is that it's a familiar and user-friendly interface to build the cross-language link. A benefit for my client's use (though perhaps a drawback for your use) is that entries must be explicitly linked together.

  • Thank you for all of the advice guys. I appreciate the response.

    @Mihai:
    In that thread you first suggest Brad Choate's SQL plugin, but then you are talking about custom fields. Is that Dan Wolfgang's plug-in or something else?

    @François:
    Thanks for that info. I checked today and they want multiple sites, one for each language, so I'm not sure your method would work as smoothly. I like the idea of serving up the user's preferred language like that and then allowing them to override that preference with a cookie. I'll have to look into that more. It may not be the best solution for this site, but it may be for some others.

    @Dan:
    Your plugin sounds like it will do what I need on the back end to associate Pages and Entries. Will this work across blogs? I was going to put Thai in one site and English in another so I can publish to different domains.
    added:
    I should have read the documentation further...it appears Reciprocal Entry Association and Reciprocal Page Association work with Blog IDs.

  • Hi Bill,

    You're welcome!

    Consider the 2nd solution that I've suggested to Hamid.

    The 1st solution is also good, but you could just follow the 2nd one and so avoid using the mtSQL plugin and building the query for it.

    Kind Regards,
    Mihai Bocsaru

  • Hi.

    Just a month ago I created a plugin exactly for your problem:
    https://github.com/semuel/mt-plugin-multilangsite

    It let you makes multiple language versions of a site and manage which page needs update.
    If you will look in the TODO section, you can see that I planed to add a tag for switching between languages, but decided to wait and see if someone will want to use this plugin.
    So if you do, I will add the tag.

    Shmuel.

  • Hi Shmuel,

    That looks like a very apropos plug-in for my situation. However, I'm using Movable Type Pro version 4.38. Would it work with that? Your plugin page says MT5.12 and up.

  • @Mihai & @Dan
    Are you guys talking about the same plug-in?

  • Hi Bill.

    Ah, sorry. didn't noticed that.
    No, the plugin uses some MT5 features (such as the listing framework) and generally assumes MT5. so it won't work on MT4.

    Shmuel.

  • Bill, I think Mihai and I are talking about slightly different solutions. I believe Mihai is describing using a text field where you can type the ID of the entry you want to link, which can then be used in a template to publish a link to the other entry.

    I think the Reciprocal Association fields are an evolution of this idea: it provides an entry picker where you can click (or search) to select an entry, so you don't need to figure out the ID. Additionally, it automatically creates the reciprocal link form the second entry to the first. Finally, you can use tags to publish a link to the other entry, as always.

  • Indeed, as Dan says my solution is kind of all fashion and doesn't rely on any plugins.

    The plugin that Dan built should be an excellent solution for this feature. When I will have some free time I would love to give it a try and see how it works.

    Also Shmuel's plugin must be an excellent tool, even if it works only on movable type v5.

    What's nice about Dan's plugin is that it works on both v4.x and v5.x. Thanks Dan!

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

code.sixapart.com

141 494

Last Topic: Action Stream for LinkedIn by michael webster on Jan 10, 2013

246 869

Last Topic: Where to download 4.38 Pro? by Karina on Jan 18, 2013

1872 6602

Last Topic: "Not Acceptable" message by JZ on Jan 14, 2013

88 305

Last Topic: absolute publish date in Manage Entries screen by .mau. on Apr 18, 2012

1512 5395

Last Topic: Unpublished entries can still be loaded by intently on Jan 17, 2013

750 3153

Last Topic: Undefined subroutine by fernandesjohnson4456 on Jan 8, 2013

89 317

Last Topic: How to "pretify" a url in htaccess with a few wildcards by Caio on May 30, 2012

192 789

Last Topic: comments not working after server migration by Liam on Jan 13, 2013

215 686

Last Topic: How Can i Manage my Link on MT5? by Ludovico Canali on Jan 7, 2013

28 96

Last Topic: Movable Price by joe22 on Jan 10, 2013

49 216

Last Topic: Movable Type 6 Ideas by Caio on May 28, 2012

65 245

Last Topic: Expanding new rich text editor and implementing table function by Takeshi Nick Osanai on Jul 30, 2012