Created
February 22, 2019 13:55
-
-
Save jacob-jonkman/cc48d1f3690bc1accf9f36881e09ef47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as fs from 'fs'; | |
const data: string = fs.readFileSync('../../i18n/messages.xlf', 'utf-8'); | |
const dataLines: string[] = data.split('\n'); | |
const regex = /(<x(\s+([^>]*))*\/>)/gi; | |
const rewrittenData = dataLines.map((line: string) => { | |
return line.replace(regex, '<x$2/>'); | |
}); | |
fs.writeFileSync('../../i18n/messages.xliff', rewrittenData.join('\n')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment