mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-16 00:19:50 -05:00
Merge pull request #2453 from nixel2007/nixel2007-patch-1
Adding {change} to files when propagination.
This commit is contained in:
commit
1d277faa28
1 changed files with 8 additions and 0 deletions
|
@ -25,6 +25,7 @@ for section in splitByCategories
|
|||
|
||||
dir = fs.readdirSync 'app/locale'
|
||||
for file in dir when not (file in ['locale.coffee', 'en.coffee'])
|
||||
fileSource = fs.readFileSync 'app/locale/' + file, encoding='utf8'
|
||||
contents = require('../app/locale/' + file)
|
||||
categories = contents.translation
|
||||
lines = ["module.exports = nativeDescription: \"#{contents.nativeDescription}\", englishDescription: \"#{contents.englishDescription}\", translation:"]
|
||||
|
@ -44,6 +45,13 @@ for file in dir when not (file in ['locale.coffee', 'en.coffee'])
|
|||
if commentsMap[enCat]? and commentsMap[enCat][enTag]?
|
||||
comment = " \##{commentsMap[enCat][enTag]}"
|
||||
|
||||
if fileSource.search(new RegExp("#? #{enTag}: \"#{tag}\".*\{change\}.*")) >= 0 and comment.search(/.*\{change\}/) < 0
|
||||
comment = " \#" + comment if comment is ""
|
||||
comment = comment + " {change}"
|
||||
|
||||
lines.push "#{if tagMissing then '#' else ''} #{enTag}: \"#{tag}\"#{comment}"
|
||||
newContents = lines.join('\n') + '\n'
|
||||
fs.writeFileSync 'app/locale/' + file, newContents
|
||||
|
||||
enSource = enSource.replace /\s?(#\s)?\{change\}/g, ""
|
||||
fs.writeFileSync 'app/locale/en.coffee', enSource
|
||||
|
|
Loading…
Reference in a new issue