How to add internationalization support to Blogger?

不羁的心 提交于 2019-12-05 23:01:21
Mike

These should be set in html head of your blog (Design -> Edit HTML, insert after <head>)

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js' type='text/javascript'></script>

<script src='http://csjs.googlecode.com/files/csjs_1.1.3.js' type='text/javascript'></script>
<script src='http://csjs.googlecode.com/files/csjs.lang_1.0.0.js' type='text/javascript'></script>
<script src='http://csjs.googlecode.com/files/csjs.browser_1.0.3.js' type='text/javascript'></script>
<script src='http://csjs.googlecode.com/files/csjs.i18n_1.2.5.js' type='text/javascript'></script>
<script src='http://csjs.googlecode.com/files/csjs.ui_1.0.6.js' type='text/javascript'></script>
<script src='http://csjs.googlecode.com/files/csjs.ui.i18n_1.0.4.js' type='text/javascript'></script>

This is very post looks like:

<!-- insert this as a title -->
<div i18n='post1_msg1'> <!-- it is worth to add default text here due to some programs that --></div>

<!-- any HTML controls to be internationalized -->
<div i18n='post1_msg2'><!-- operate blog content (like rss reader) will not download script --></div>

<script type="text/javascript">
    i18n.load( {
        'en' : {
            'post1_msg1' : 'First Post',
            'post1_msg2' : 'Post content'
        },
        'ru' : {
            'post1_msg1' : 'Первое сообщение',
            'post1_msg2' : 'Текст сообщения'
        },
        'uk' : {
            'post1_msg1' : 'Перше повідомлення',
            'post1_msg2' : 'Текст повідомлення'
        }
    });
</script>

Add language selector as a gadget (Design -> Page Elements -> Add a Gadget -> Basics -> HTML/JavaScript).

<div csjs-ctrl-class="csjs.ui.i18n.ListLanguageSwitch"></div>

About csjs library.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!