Skip to content

Commit

Permalink
genl10n.py - exclude commented lines
Browse files Browse the repository at this point in the history
  • Loading branch information
metasmile authored Aug 30, 2018
1 parent e8e4483 commit d094d99
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion utils/genl10n.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

parser.add_argument('src_path', help='Main swift source path, default=./)',
default='./', nargs='?')
parser.add_argument('dest_l10n_base_path', help='Target Base localization resource path. (root path of Base.lproj, default=./)',
parser.add_argument('dest_l10n_base_path', help='Target Base Localizable.strings path. (default=./)',
default='./', nargs='?')
parser.add_argument('-k', '--split-key',
help='Splitting identifier to extract strings from Swift code. (e.g. "This is string".localized )',
Expand All @@ -39,6 +39,8 @@

# for excluing format literal -> \(value)
qs = re.compile(r'\\\((.+)\)', re.I|re.U)
# for excluing code comment
cs = re.compile(r'\/\/.*', re.I|re.U)

swift_files = []

Expand All @@ -51,6 +53,10 @@
rcur = codecs.open(code_file, "r", "utf-8")
wlines = []
for i, line in enumerate(rcur.readlines()):

if cs.search(line):
line = cs.sub("", line)

for line_sp in line.split(split_key):

for p in complied_patterns_by_priority:
Expand Down

0 comments on commit d094d99

Please sign in to comment.