Reputation: 33
Below is the quote of answer by Mykhaylo Adamovych on topic "How to add internationalization support to Blogger?"
This code works, but there is one catch, when you add links to the text html won't recognize them, generally, none html codes are recognized in the text and they are written as they are.
Is it possible to make modification which would recognize codes?
... and here is implementation
These should be set in html head of your blog (Blog Design -> Edit HTML, insert after <head>)
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <script type="text/javascript" src="http://csjs.googlecode.com/files/csjs.i18n_1.0.0.js"></script>
This is very post looks like:
<!-- insert this as a title --> <div id='post1_div1' msgId='post1_msg1'> <!-- it is worth
to add default text here due to some programs that -->
<!-- any HTML controls to be internationalized --> <div id='post1_div2' msgId='post1_msg2'><!-- operate blog
content (like rss reader) will not download script -->
<!-- add language selector in the bottom of the post --> <div> <a onclick="i18n.trigger('en')"
style="display: inline; margin: 2px">en ru ua
<script type="text/javascript"> i18n.load( { 'en' : { 'post1_msg1' : 'First Post', 'post1_msg2' : 'Post content' }, 'ua' : { 'post1_msg1' : 'Перше повідомлення', 'post1_msg2' : 'Текст повідомлення' }, 'ru' : { 'post1_msg1' : 'Первое сообщение', 'post1_msg2' : 'Текст сообщения' } }); /* bind all elements with internationalized messages to language
change event */ jQuery('#post1_div1').bind('i18n', i18n.update); jQuery('#post1_div2').bind('i18n', i18n.update);
/* fill elements with internationalized content */ i18n.trigger(null); </script>
Due to blogger preprocessor newlines should be removed between <script></script> tags.
I've used gvim and it Shift+j magic keys.
Upvotes: 1
Views: 633
Reputation: 33
Here is some draft tool for internationalization, which works perfectly with blogger.
Link: http://i18nblog.blogspot.com/
Just put html code on the one tab and click on another ;)
Upvotes: 1
Reputation: 20966
Why do you need to put HTML code inside messages? Common approach here is to design HTML page, then any simplest messages surround with div elements with unique ids to be able to manage them by script. You can create internationalized link like this:
<a href="http://google.com">
<div id='post1_div2' msgId='post1_msg2'><!-- operate blog content (like some of rss reader) will not download script --></div>
</a>
Or could you describe original problem please?
Upvotes: 0
Reputation: 2141
Looks like you just need to replace jQuery(this).text
with jQuery(this).html
inside the update
function of the I18N plugin.
Upvotes: 0