Pages

Friday, July 13, 2012

How to create dual language blog

Some time ago I wanted to have two languages on my blog - one for my natives, one international. WordPress have a solution called WPML but it's paid solution. Second thing, I have blogger running so long I don't want to transfer.


I've found simple solution!



This method changes main/home/base adress/domain and leads to same URL on other adress/domain. It's also simple installed, just one HTML/JS widget :)

What you should do before:
1. Create two blogs in two different languages.
2. Go to Settings->Search options and make a link to your own site in "page not found code" just in case :) it can look like:
There is nothing in this link, please continue on <a href="http://olesku.pl">Olesku.pl</a>.
Put your adress instead of mine ;)

---
Now in both of them in Layout, create a widget "HTML/Javascript" and paste this code:

<script language="javascript" type="text/javascript"> 
document.write ("<a href=" + window.location.protocol + "//" + "theotherlanguageadress.com" + window.location.pathname + ">the other language name</a>"); 
</script>

Put adress of the second-language-blog in theotherlanguageadress.com and name of language used in another blog in the other language name. 

---
Writing new post:
1. go to blog of first language, click New Post
2. put some title
3. put the text, images etc
4. put labels etc.

5. copy all info from points 2,3,4 to New Post in other language
6. publish posts

7. now you can edit post, change titles to the proper ones in both languages, change text in second language post etc
8. don't translate labels!!!

Procedure for new pages is exactly same :)

---

What you need to know:



You must have all links exact same in both languages. That's why you have to publish posts and pages with exact titles (you can edit later, but URL of post will be created at first time). Also that's the reason to have all labels exact same for all languages.

What works? Changing language while reading post, when looking for label, on archive pages.

What is not working? Every URL containing question mark (?) doesn't work. For example links to comments are not working; also changing language while looking for older posts is not -> search works by '?' sign so URLs are being shortened to everything before "?" sign. It's not so important, because most visitors will change language at first; also they probably won't be interested in comments in other language.

No comments:

Post a Comment