问题
How to add internationalization support to Blogger?
Is it possible to deal with multiple languages within one blog?
Is it possible to add own translation and don't use Google Translate widget?
Thanks.
回答1:
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.
回答2:
found useful related discussions
https://stackoverflow.com/questions/48726/best-javascript-i18n-techniques-ajax-dates-times-numbers-currency
How does internationalization work in JavaScript?
来源:https://stackoverflow.com/questions/4909879/how-to-add-internationalization-support-to-blogger