Skip to content

quytinh/pali

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pāḷi Tipiṭaka & Dictionary

My development environment is Ubuntu 13.04 with Python 2.7. If you are using Windows, i18nUtils.py cannot be run unless you install GNU gettext tools, which include xgettext, msginit, msgmerge, and msgfmt. However, I do not know how to install GNU gettext tools on Windows.

The data files, including Pāḷi texts, translations, and dictionaries, are located at data repository. Some Python and JavaScript libraries are also in data repository.

Please install necessary tools for development before setting up development environment.

Set Up Development Environment

PALI_DIR below means the directory where you git clone pali repository.

  1. git clone the pali repository and data repository (put in the same directory).
    # create a directory to contain both pali and data repository.
    $ mkdir dev
    $ cd dev
    # git clone repositories
    $ git clone https://github.com/siongui/pali.git
    $ git clone https://github.com/siongui/data.git
  1. Run PALI_DIR/setup/setupdev.py to create symbolic links. (pali repository and data repository must be put under the same directory. Otherwise symlinks will not point to correct directories.)
    $ python PALI_DIR/setup/setupdev.py
  1. Create i18n files (pot, po, mo files under PALI_DIR/common/locale/ directory) for use on dev and production server:
    $ cd PALI_DIR/setup/
    # create i18n files
    $ python i18nUtils.py pot
    $ python i18nUtils.py po
    $ python i18nUtils.py cn
    $ python i18nUtils.py mo

    # create JavaScript file of translated strings for the client browser
    $ python i18nUtils.py js
  1. Create index of words in dictionary books.
    $ cd PALI_DIR/dictionary/setup/
    $ python init1parseBooks.py
    $ python init2parseWords.py
    $ python init3prefixWordsHtml.py

    # build succinct trie of words
    $ cd PALI_DIR/dictionary/setup/nodejs
    $ nodejs buildSuccinctTrie.js
    $ cd PALI_DIR/dictionary/setup/
    $ python init4jsonToJS.py

    $ cd PALI_DIR/dictionary
    # Install grunt plugins
    $ npm install
    # combine and minify JavaScript/CSS.
    $ grunt
    # ctrl-C to abort watching, and then run dev server.
    $ python devNotGaeRun.py
  1. See if dictionary website works: (Please keep above dev server running)
    # open browser to test local dev server:
    # http://localhost:8080/
  1. Create Tipiṭaka-related translations for server and client.
    $ cd PALI_DIR/tipitaka/setup/
    $ python setTranslationData.py
  1. Create data files used for Pāḷi Tipiṭaka and path of webpages of online Pāḷi Tipiṭaka website:
    $ cd PALI_DIR/tipitaka/setup/
    $ python init1getTocs.py
    $ python init2tocsToJson.py
    $ python init3addSubpathInJson.py

    $ cd PALI_DIR/tipitaka
    # Install grunt plugins
    $ npm install
    # combine and minify JavaScript/CSS.
    $ grunt
    # ctrl-C to abort watching, and then run dev server.
    $ python devNotGaeRun.py
  1. See if tipiṭaka website works: (Please keep above dev server running)
    # open browser to test local dev server:
    # http://localhost:8080/
  1. Deploy on AWS EC2: See AWS.md

Development of Python/JavaScript/HTML/CSS code for the websites

Open and keep two terminals running, one for running dev server, the other for running grunt watch. The changes you make can be viewed from http://localhost:8080/ in your browser window. (reload the page if the window is already open)

# open one termimal
$ cd PALI_DIR/dictionary    # if you are developing dictionary website
$ cd PALI_DIR/tipitaka      # if you are developing tipitaka website
# combine and minify JavaScript/CSS. Re-combine and re-minify if any changes made.
$ grunt

# open another terminal
$ cd PALI_DIR/dictionary    # if you are developing dictionary website
$ cd PALI_DIR/tipitaka      # if you are developing tipitaka website
# run dev server
$ python devNotGaeRun.py

# open browser window at the following URL
# http://localhost:8080/

Development of i18n

Everytime strings in html files are marked to be translated, remember to re-generate i18n files and re-compile JavaScript files. A helper script named i18nUtils.py (located under PALI_DIR/setup/) to automate the i18n jobs.

$ cd PALI_DIR/setup/
# create POT from html files
$ python i18nUtils.py pot
# initialize PO files if not exist, or update POs files if exist.
$ python i18nUtils.py po
# after initialization, edit PO files and translate strings in PO files. Then
$ python i18nUtils.py cn
# the above command update zh_CN PO file from zh_TW PO file,
# so you do not have to manual translate (optional if you want to manually translate zh_CN PO file).
# then create MO files for server-side i18n
$ python i18nUtils.py mo
# create files for client-side i18n
$ python i18nUtils.py js

# run grunt to update files
$ cd PALI_DIR/dictionary
$ grunt
# ctrl-C to abort grunt watch
$ cd PALI_DIR/tipitaka
$ grunt

About

Pāḷi Tipiṭaka and Pāḷi Dictionaries

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 57.3%
  • JavaScript 42.7%