[gen] Added base Appy i18n files containing standard Appy labels.

This commit is contained in:
Gaetan Delannay 2013-10-20 18:12:39 +02:00
parent 1faba191b2
commit 14f4848348
16 changed files with 5643 additions and 370 deletions

View file

@ -5,7 +5,7 @@ import sys, os.path
from optparse import OptionParser
from appy.gen.generator import GeneratorError, ZopeGenerator
from appy.shared.utils import LinesCounter
from appy.shared.packaging import Debianizer, Cortexer
from appy.shared.packaging import Debianizer
import appy.version
# ------------------------------------------------------------------------------
@ -18,25 +18,8 @@ C_OPTION = 'Removes from i18n files all labels that are not automatically ' \
'attributes, states, transitions, etc): in this case, the Appy ' \
'i18n label generation machinery produces lots of labels that ' \
'then become obsolete.'
S_OPTION = 'Sorts all i18n labels. If you use this option, among the ' \
'generated i18n files, you will find first all labels ' \
'that are automatically generated by appy.gen, in some logical ' \
'order (ie: field-related labels appear together, in the order ' \
'they are declared in the gen-class). Then, if you have added ' \
'labels manually, they will appear afterwards. Sorting labels ' \
'may not be desired under development. Indeed, when no sorting ' \
'occurs, every time you add or modify a field, class, state, etc, ' \
'newly generated labels will all appear together at the end of ' \
'the file; so it will be easy to translate them all. When sorting ' \
'occurs, those elements may be spread at different places in the ' \
'i18n file. When the development is finished, it may be a good ' \
'idea to sort the labels to get a clean and logically ordered ' \
'set of translation files.'
D_OPTION = 'Generates a Debian package for this app. The Debian package will ' \
'be generated at the same level as the root application folder.'
X_OPTION = 'Generates a Cortex application definition for this app, in a ' \
'folder "cortex.admin" that will be generated at the same level ' \
'as the root application folder.'
class GeneratorScript:
'''usage: %prog [options] app
@ -67,12 +50,8 @@ class GeneratorScript:
optParser = OptionParser(usage=GeneratorScript.__doc__)
optParser.add_option("-c", "--i18n-clean", action='store_true',
dest='i18nClean', default=False, help=C_OPTION)
optParser.add_option("-s", "--i18n-sort", action='store_true',
dest='i18nSort', default=False, help=S_OPTION)
optParser.add_option("-d", "--debian", action='store_true',
dest='debian', default=False, help=D_OPTION)
optParser.add_option("-x", "--cortex", action='store_true',
dest='cortex', default=False, help=X_OPTION)
(options, args) = optParser.parse_args()
try:
self.manageArgs(optParser, options, args)
@ -92,9 +71,6 @@ class GeneratorScript:
f.close()
version = version[:version.find('build')-1]
Debianizer(app, appDir, appVersion=version).run()
# Generates a Cortex application definition if required
if options.cortex:
Cortexer(args[0]).run()
except GeneratorError, ge:
sys.stderr.write(str(ge))
sys.stderr.write('\n')