Open main menu

CDOT Wiki β

Changes

Automated localization build tool

1,766 bytes added, 17:48, 13 October 2007
m
regular expressions information
* To fill out what is missing in the source of your localization
* MOZ_CO_PROJECT=browser make -f tools/l10n/l10n.mk '''create-en-GB'''
 
=== Regular expressions ===
* [http://docs.python.org/lib/re-syntax.html http://docs.python.org/lib/re-syntax.html]
* [http://www.amk.ca/python/howto/regex/ http://www.amk.ca/python/howto/regex/]
* Change we should make to a localization source code(I'm not sure about the regular expressions):
>> color(s) -> colour(s) -- re.sub(r'([Cc])olor', r'\1olour', instring)
>> Organize -> Organise
>> Customize -> Customise
 
=== DTD regular expression analysis ===
* An analysis of regular expression, specific to DTDs (from Parser.py)
self.key = re.compile('<!ENTITY\s+([\w\.]+)\s+(\"(?:[^\"]*\")|(?:\'[^\']*)\')\s*>', re.S)
'''\s+''' - one or more (??) blank spaces, tabs, end of line, and others whitespace elements
'''([\w\.]+)''' - one or more alphanumeric characters and/or(??) a dot
'''\s+''' - more of the same
'''(\"(?:[^\"]*\")|(?:\'[^\']*)\')''' - if the left of '|' matches the right part doesn't get analyzed
* ''(\"(?:[^\"]*\")'' - matching something in between " and "
* (?:[^\"]* - '''I'M NOT SURE OF THIS PART'''
* ''(?:\'[^\']*)\')'' -
*
'''\s*''' - none or more(??) white characters
'''re.S''' - makes the dot to match even new lines - it is like raising DOTALL flag
A matching line:
* ''<!ENTITY colorsDialog.title "Colors">''
 
=== Related regular expressions theory ===
* (...) what is inside the parentheses are a group - the contents of a group can be retrieved after a match has been performed, and can be matched later in the string with the ''\number'' special sequence
* (?...) - This is an '''extension notation''' - Extensions usually do not create a new group; (?P<name>...) is the only exception to this rule. Following are the currently supported extensions.
* List of supported extensions: (?iLmsux), (?:...), (?P<name>...), (?P=name), (?#...), (?=...), (?!...), (?<=...), (?<!...), (?(id/name)yes-pattern|no-pattern)
* \number - Matches the contents of the group of the same number. Groups are numbered starting from 1.
== Project news ==
1
edit