#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# <terry.yinzhe@gmail.com> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return to Terry Yin.
#
# The idea of this is borrowed from <mort.yao@gmail.com>'s brilliant work
#    https://github.com/soimort/google-translate-cli
# He uses "THE BEER-WARE LICENSE". That's why I use it too. So you can buy him a 
# beer too.
# ----------------------------------------------------------------------------
from translate import main

if __name__ == "__main__":
    try:
        import ConfigParser, os
        parser = ConfigParser.SafeConfigParser({'from_lang': 'en', 'to_lang': 'zh'})
        fn = os.path.expanduser('~/.python-translate.cfg')
        if not parser.read(fn):
            with open(fn, 'wb') as configfile:
                parser.write(configfile)
        d = 'DEFAULT'
        config = {'f': parser.get(d,'from_lang'), 't':parser.get(d,'to_lang') }
    except ImportError:
      config = {'f': 'zh', 't':'en' }
    main(config)
