~cypheon/elfelli

2c8c49a9b47fa57bf5375990aa5dfffe34b84474 — Johann Rudloff 15 years ago c6c0fef 0.1
Added README and improved i18n script.
3 files changed, 69 insertions(+), 3 deletions(-)

A README
M SConstruct
R update_i18n.py => i18n.py
A README => README +41 -0
@@ 0,0 1,41 @@

----------------
 ELFELLI README
----------------

This is Elfelli, a tool to calculate and visualize electric flux lines
around charged bodies.
To run Elfelli, gtkmm, at least version 2.8, needs to be installed. 


-----------
 COMPILING
-----------

To compile Elfelli, you need SCons. In many distributions you will also
need the development package of gtkmm (in Debian this is 'libgtkmm-2.4-dev').
Compiling itself is very simple:

$ scons


--------------
 INSTALLATION
--------------

To install Elfelli, simply type:

$ scons install

By default, it is installed in '/usr/local'. If you want to change that
prefix, alter the install command to:

$ scons install prefix=/install/prefix


------
 BUGS
------

If you find any, please report them at the Gna! project page:
https://gna.org/bugs/?func=additem&group=elfelli

M SConstruct => SConstruct +1 -1
@@ 65,7 65,7 @@ if 'install' in targets:
        except OSError,e:
                print 'Error %d: %s' % (e[0],e[1])
                Exit(1)
        os.system('./update_i18n.py install %s' % paths['localedir'])
        os.system('./i18n.py install %s' % paths['localedir'])


env.AppendUnique(CPPFLAGS=r'-DDATADIR=\"%s\" '%paths['datadir'])

R update_i18n.py => i18n.py +27 -2
@@ 3,6 3,14 @@
import os, sys
from glob import glob

usage = """This is the i18n helper script for Elfelli

Usage:
./i18n.py [update]              Update po files, generate mo files.
./i18n.py install /path/locale  Install mo files in this path.
./i18n.py init <locale> ...     Initialise translations.
"""

def find_locales():
    po_files = glob('po/*.po')
    locales = [file[3:-3] for file in po_files]


@@ 34,11 42,28 @@ def install_mo_files(locales, dest):
            o = '-oroot -groot '
        os.system('install -v -m644 %s -D po/locale/%s/LC_MESSAGES/elfelli.mo %s/%s/LC_MESSAGES/elfelli.mo' % (o, locale, dest, locale))

def init_translation(locale):
    print 'Initialising %s locale...' % locale
    os.system('msginit -i po/elfelli.pot -o po/%s.po' % locale)

if __name__ == '__main__':
    locales = find_locales();
    locales = find_locales()
    if len(sys.argv) == 1 or sys.argv[1] == 'update':
        update_pot()
        update_po_files(locales)
        compile_po_files(locales)
    elif len(sys.argv) == 3 and sys.argv[1] == 'install':

    elif (sys.argv[1] == 'install') and (len(sys.argv) == 3):
        install_mo_files(locales, sys.argv[2]);

    elif (sys.argv[1] == 'init') and (len(sys.argv) >= 3):
        update_pot()
        for locale in sys.argv[2:]:
            if not (locale in locales):
                init_translation(locale)
            else:
                print "A '%s' translation already exists!" % locale
            locales = find_locales()

    else:
        print usage