diff options
author | Sebastian <sebasjm@gmail.com> | 2022-12-09 09:28:31 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-12-09 09:28:31 -0300 |
commit | 4ccdcf3058738d5139df2737f49399c3b08877c4 (patch) | |
tree | 344bcd06e1bae3aad1dc78786dff3c1d96177e89 /packages/pogen/src/potextract.ts | |
parent | 0bd47e107c9127561da33719a0a7c6de88c35f2e (diff) | |
download | wallet-core-4ccdcf3058738d5139df2737f49399c3b08877c4.tar.xz |
use string-prelude and poheader if it is present
Diffstat (limited to 'packages/pogen/src/potextract.ts')
-rw-r--r-- | packages/pogen/src/potextract.ts | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/packages/pogen/src/potextract.ts b/packages/pogen/src/potextract.ts index 8961c8da0..e75c17d55 100644 --- a/packages/pogen/src/potextract.ts +++ b/packages/pogen/src/potextract.ts @@ -21,6 +21,26 @@ import * as ts from "typescript"; import * as fs from "fs"; import * as path from "path" +const DEFAULT_PO_HEADER = `# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2016-11-23 00:00+0100\\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n" +"Language-Team: LANGUAGE <LL@li.org>\\n" +"Language: \\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=UTF-8\\n" +"Content-Transfer-Encoding: 8bit\\n"\n\n` + + function wordwrap(str: string, width: number = 80): string[] { var regex = ".{1," + width + "}(\\s|$)|\\S+(\\s|$)"; return str.match(RegExp(regex, "g")); @@ -417,28 +437,14 @@ export function potextract() { !prog.isSourceFileDefaultLibrary(x), ); - // console.log(ownFiles.map((x) => x.fileName)); - - const chunks = []; + let header: string + try { + header = fs.readFileSync("src/i18n/poheader", "utf-8") + } catch (e) { + header = DEFAULT_PO_HEADER + } - chunks.push(`# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2016-11-23 00:00+0100\\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n" -"Language-Team: LANGUAGE <LL@li.org>\\n" -"Language: \\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=UTF-8\\n" -"Content-Transfer-Encoding: 8bit\\n"\n\n`); + const chunks = [header]; const knownMessageIds = new Set<string>(); |