i18nJS
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:Javascript utility for having multi language HTML pages
Javascript utility for having multilanguage HTML pages.

[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=islegmar&url=https://github.com/islegmar/i18nJS&title=i18nJS&language=&tags=github&category=software) 

===============
ANXIOUS INSTALL
===============
You already have an HTML page full of "Lorem ipsum" and you want to have it in
several languages as catalan (ca), spanish (es) and english (es).

0) Preconditions
   Just to keep the things easier, we suppose we have the following initial situation:
   + You have an 'index,html' that need to be translated.
   + At the same level that index.html there is a folder 'js/' and inside it
     you have copied 'I18N.js'
   + At the same level that index.html there is a folder 'i18n/' and inside it
     you have created so many empty files as languages you want (the i18-files).
     The names of the files are:
       . i18n/i18n_ca.txt (for Catalan)
       . i18n/i18n_es.txt (for Spanish)
       . i18n/i18n_en.txt (for English)
       . .......
   + You can access to your 'index.html'  via a WebServer, using http://....../index.html
     Sorry but, as we say in spanish "lo que no puede ser, no puede ser y además
     es imposible". This library uses AJAX and you can not use it if you open 
     your file locally. If you do it, you will see the original page without any translations.   

Now we can start!

1) Add the JS
   In the 
add 2) Identify all the elements that need translation. Search in the HTML all the elements (span, div, p, h...) that containt text to be translated. To each element: - Add an attribute 'id' if it does not have it (id should identifies the kind of information). - Add the class "i18n" Example: Something like

Our company has lorem ipsum....

=> This information is the Overview if the company will be changed in

Our company has lorem ipsum....

=> This information is the Overview if the company 3) Build the files with the translations. Open the page in the browser (rememeber, via htpp:/.....). An alert is shown with the template for the translations. Copy it in the 'i18n-files' you have created before, with the right translation for each language. 4) Add a language selector. It is a serie of links for changing the languages. Each selector has an id. Example: 5) Final configuration Replace the line i18n.buildJSON(); by i18n.setDefLang("en"); /* Your default language */ i18n.setLangSelectors([ ['sel_ca','ca'],['sel_es','es'],['sel_en','en'] ]); i18n.loadAndTranslate(); 6) Load the page again. Now you will be able to change language. That's all! ===================== COFFEEE BREAK INSTALL ===================== Ok, now you've more time (take your coffee) and you want to explore all the options. Welcome! TO BE DONE

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。