@breadstone-tools/localizator-core 0.0.92 → 0.0.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/package.json +2 -2
- package/Resources/PoFileParser.d.ts +0 -48
- package/Resources/PoFileParser.d.ts.map +0 -1
- package/Resources/PoFileParser.js +0 -111
- package/Resources/PoFileParser.js.map +0 -1
- package/Resources/PoFileReader.d.ts +0 -25
- package/Resources/PoFileReader.d.ts.map +0 -1
- package/Resources/PoFileReader.js +0 -43
- package/Resources/PoFileReader.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
## 0.0.92 (2025-08-08)
|
|
2
|
+
|
|
3
|
+
This was a version bump only for localizator-core to align it with other projects, there were no code changes.
|
|
4
|
+
|
|
5
|
+
## 0.0.91 (2025-08-08)
|
|
6
|
+
|
|
7
|
+
This was a version bump only for localizator-core to align it with other projects, there were no code changes.
|
|
8
|
+
|
|
9
|
+
## 0.0.90 (2025-08-08)
|
|
10
|
+
|
|
11
|
+
This was a version bump only for localizator-core to align it with other projects, there were no code changes.
|
|
12
|
+
|
|
13
|
+
## 0.0.89 (2025-08-05)
|
|
14
|
+
|
|
15
|
+
This was a version bump only for localizator-core to align it with other projects, there were no code changes.
|
|
16
|
+
|
|
17
|
+
## 0.0.88 (2025-08-04)
|
|
18
|
+
|
|
19
|
+
### 🚀 Features
|
|
20
|
+
|
|
21
|
+
- add executor options types and schema generation script; remove unused dependencies ([eb71956d5a](https://github.com/RueDeRennes/mosaik/commit/eb71956d5a))
|
|
22
|
+
|
|
23
|
+
## 0.0.87 (2025-08-04)
|
|
24
|
+
|
|
25
|
+
This was a version bump only for localizator-core to align it with other projects, there were no code changes.
|
|
26
|
+
|
|
27
|
+
## 0.0.86 (2025-08-04)
|
|
28
|
+
|
|
29
|
+
### 🚀 Features
|
|
30
|
+
|
|
31
|
+
- **translations:** add theme label to translations ([bde199ef08](https://github.com/RueDeRennes/mosaik/commit/bde199ef08))
|
|
32
|
+
|
|
1
33
|
## 0.0.85 (2025-08-01)
|
|
2
34
|
|
|
3
35
|
This was a version bump only for localizator-core to align it with other projects, there were no code changes.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@breadstone-tools/localizator-core",
|
|
3
3
|
"description": "Localizator core library",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.94",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "andre.wehlert <awehlert@breadstone.de> (https://www.breadstone.de)",
|
|
7
7
|
"repository": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"module": "./Index.js",
|
|
14
14
|
"types": "./Index.d.ts",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@breadstone-infrastructure/utilities": "^0.0.
|
|
16
|
+
"@breadstone-infrastructure/utilities": "^0.0.94",
|
|
17
17
|
"cheerio": "^1.1.2"
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { PoFileReader } from './PoFileReader';
|
|
2
|
-
/**
|
|
3
|
-
* Represents an entry in a PO file.
|
|
4
|
-
*
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export interface IPoEntry {
|
|
8
|
-
msgid: string;
|
|
9
|
-
msgstr: string;
|
|
10
|
-
comments?: string;
|
|
11
|
-
context?: string;
|
|
12
|
-
references?: Array<string>;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* A class to parse and handle PO files.
|
|
16
|
-
*
|
|
17
|
-
* @public
|
|
18
|
-
*/
|
|
19
|
-
export declare class PoFileParser {
|
|
20
|
-
private _entries;
|
|
21
|
-
/**
|
|
22
|
-
* Parses a PO file from the given content.
|
|
23
|
-
*
|
|
24
|
-
* @param content - The content of the PO file as a string.
|
|
25
|
-
*/
|
|
26
|
-
parse(content: string): void;
|
|
27
|
-
/**
|
|
28
|
-
* Returns all parsed entries.
|
|
29
|
-
*
|
|
30
|
-
* @returns The array of PO entries.
|
|
31
|
-
*/
|
|
32
|
-
getEntries(): Array<IPoEntry>;
|
|
33
|
-
/**
|
|
34
|
-
* Reads and parses a PO file using the provided reader.
|
|
35
|
-
*
|
|
36
|
-
* @param reader - The `PoFileReader` instance.
|
|
37
|
-
* @returns A promise resolving when the file is fully parsed.
|
|
38
|
-
*/
|
|
39
|
-
parseFromFile(reader: PoFileReader): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* Extracts the value from a line in the PO file.
|
|
42
|
-
*
|
|
43
|
-
* @param line - The line to extract the value from.
|
|
44
|
-
* @returns The extracted value.
|
|
45
|
-
*/
|
|
46
|
-
private extractValue;
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=PoFileParser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PoFileParser.d.ts","sourceRoot":"","sources":["../../src/Resources/PoFileParser.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC9B;AAED;;;;GAIG;AACH,qBAAa,YAAY;IAIrB,OAAO,CAAC,QAAQ,CAAuB;IAMvC;;;;OAIG;IACI,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAwDnC;;;;OAIG;IACI,UAAU,IAAI,KAAK,CAAC,QAAQ,CAAC;IAIpC;;;;;OAKG;IACU,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAK/D;;;;;OAKG;IACH,OAAO,CAAC,YAAY;CAOvB"}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
3
|
-
// #region Imports
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.PoFileParser = void 0;
|
|
6
|
-
/**
|
|
7
|
-
* A class to parse and handle PO files.
|
|
8
|
-
*
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
class PoFileParser {
|
|
12
|
-
// #region Fields
|
|
13
|
-
_entries = [];
|
|
14
|
-
// #endregion
|
|
15
|
-
// #region Methods
|
|
16
|
-
/**
|
|
17
|
-
* Parses a PO file from the given content.
|
|
18
|
-
*
|
|
19
|
-
* @param content - The content of the PO file as a string.
|
|
20
|
-
*/
|
|
21
|
-
parse(content) {
|
|
22
|
-
this._entries = [];
|
|
23
|
-
const lines = content.split('\n');
|
|
24
|
-
let currentEntry = {};
|
|
25
|
-
let isMultiline = false;
|
|
26
|
-
let multilineKey = null;
|
|
27
|
-
for (const line of lines) {
|
|
28
|
-
const trimmed = line.trim();
|
|
29
|
-
if (trimmed.startsWith('#')) {
|
|
30
|
-
// Handle comments
|
|
31
|
-
currentEntry.comments = `${(currentEntry.comments ?? '') + trimmed}\n`;
|
|
32
|
-
}
|
|
33
|
-
else if (trimmed.startsWith('#:')) {
|
|
34
|
-
// Handle references
|
|
35
|
-
currentEntry.references ??= [];
|
|
36
|
-
currentEntry.references.push(trimmed.substring(2).trim());
|
|
37
|
-
}
|
|
38
|
-
else if (trimmed.startsWith('msgctxt')) {
|
|
39
|
-
// Handle context
|
|
40
|
-
currentEntry.context = this.extractValue(trimmed);
|
|
41
|
-
}
|
|
42
|
-
else if (trimmed.startsWith('msgid')) {
|
|
43
|
-
// Handle msgid
|
|
44
|
-
if (isMultiline) {
|
|
45
|
-
// @ts-ignore
|
|
46
|
-
currentEntry[multilineKey] += this.extractValue(trimmed);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
currentEntry.msgid = this.extractValue(trimmed);
|
|
50
|
-
isMultiline = !trimmed.endsWith('"');
|
|
51
|
-
multilineKey = 'msgid';
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
else if (trimmed.startsWith('msgstr')) {
|
|
55
|
-
// Handle msgstr
|
|
56
|
-
if (isMultiline) {
|
|
57
|
-
// @ts-ignore
|
|
58
|
-
currentEntry[multilineKey] += this.extractValue(trimmed);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
currentEntry.msgstr = this.extractValue(trimmed);
|
|
62
|
-
isMultiline = !trimmed.endsWith('"');
|
|
63
|
-
multilineKey = 'msgstr';
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
else if (!trimmed && currentEntry.msgid) {
|
|
67
|
-
// End of entry
|
|
68
|
-
this._entries.push({
|
|
69
|
-
msgid: currentEntry.msgid ?? '',
|
|
70
|
-
msgstr: currentEntry.msgstr ?? '',
|
|
71
|
-
comments: currentEntry.comments?.trim(),
|
|
72
|
-
context: currentEntry.context,
|
|
73
|
-
references: currentEntry.references
|
|
74
|
-
});
|
|
75
|
-
currentEntry = {};
|
|
76
|
-
isMultiline = false;
|
|
77
|
-
multilineKey = null;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Returns all parsed entries.
|
|
83
|
-
*
|
|
84
|
-
* @returns The array of PO entries.
|
|
85
|
-
*/
|
|
86
|
-
getEntries() {
|
|
87
|
-
return this._entries;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Reads and parses a PO file using the provided reader.
|
|
91
|
-
*
|
|
92
|
-
* @param reader - The `PoFileReader` instance.
|
|
93
|
-
* @returns A promise resolving when the file is fully parsed.
|
|
94
|
-
*/
|
|
95
|
-
async parseFromFile(reader) {
|
|
96
|
-
const content = await reader.readFileContent();
|
|
97
|
-
this.parse(content);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Extracts the value from a line in the PO file.
|
|
101
|
-
*
|
|
102
|
-
* @param line - The line to extract the value from.
|
|
103
|
-
* @returns The extracted value.
|
|
104
|
-
*/
|
|
105
|
-
extractValue(line) {
|
|
106
|
-
const match = (/"(.*)"/).exec(line);
|
|
107
|
-
return match ? match[1] : '';
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
exports.PoFileParser = PoFileParser;
|
|
111
|
-
//# sourceMappingURL=PoFileParser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PoFileParser.js","sourceRoot":"","sources":["../../src/Resources/PoFileParser.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,kBAAkB;;;AAmBlB;;;;GAIG;AACH,MAAa,YAAY;IAErB,iBAAiB;IAET,QAAQ,GAAoB,EAAE,CAAC;IAEvC,aAAa;IAEb,kBAAkB;IAElB;;;;OAIG;IACI,KAAK,CAAC,OAAe;QACxB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,YAAY,GAAsB,EAAE,CAAC;QACzC,IAAI,WAAW,GAAG,KAAK,CAAC;QACxB,IAAI,YAAY,GAA0B,IAAI,CAAC;QAE/C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YAE5B,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC1B,kBAAkB;gBAClB,YAAY,CAAC,QAAQ,GAAG,GAAG,CAAC,YAAY,CAAC,QAAQ,IAAI,EAAE,CAAC,GAAG,OAAO,IAAI,CAAC;YAC3E,CAAC;iBAAM,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBAClC,oBAAoB;gBACpB,YAAY,CAAC,UAAU,KAAK,E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CAAC,QAAQ,CAAC,IAAI,CAAC;oBACf,KAAK,EAAE,YAAY,CAAC,KAAK,IAAI,EAAE;oBAC/B,MAAM,EAAE,YAAY,CAAC,MAAM,IAAI,EAAE;oBACjC,QAAQ,EAAE,YAAY,CAAC,QAAQ,EAAE,IAAI,EAAE;oBACvC,OAAO,EAAE,YAAY,CAAC,OAAO;oBAC7B,UAAU,EAAE,YAAY,CAAC,UAAU;iBACtC,CAAC,CAAC;gBACH,YAAY,GAAG,EAAE,CAAC;gBAClB,WAAW,GAAG,KAAK,CAAC;gBACpB,YAAY,GAAG,IAAI,CAAC;YACxB,CAAC;QACL,CAAC;IACL,CAAC;IAED;;;;OAIG;IACI,UAAU;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,aAAa,CAAC,MAAoB;QAC3C,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,eAAe,EAAE,CAAC;QAC/C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACK,YAAY,CAAC,IAAY;QAC7B,MAAM,KAAK,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACjC,CAAC;CAIJ;AAxGD,oCAwGC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Class for reading `.po` files.
|
|
3
|
-
*
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export declare class PoFileReader {
|
|
7
|
-
private readonly _fileReader;
|
|
8
|
-
/**
|
|
9
|
-
* Constructs a new instance of the `PoFileReader` class.
|
|
10
|
-
*
|
|
11
|
-
* @param filePath - The path to the `.po` file.
|
|
12
|
-
*/
|
|
13
|
-
constructor(filePath: string);
|
|
14
|
-
/**
|
|
15
|
-
* Reads the entire content of the `.po` file.
|
|
16
|
-
*
|
|
17
|
-
* @returns A promise resolving to the file content as a string.
|
|
18
|
-
*/
|
|
19
|
-
readFileContent(): Promise<string>;
|
|
20
|
-
/**
|
|
21
|
-
* Disposes the underlying file reader.
|
|
22
|
-
*/
|
|
23
|
-
dispose(): void;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=PoFileReader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PoFileReader.d.ts","sourceRoot":"","sources":["../../src/Resources/PoFileReader.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,qBAAa,YAAY;IAIrB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAM1C;;;;OAIG;gBACgB,QAAQ,EAAE,MAAM;IAQnC;;;;OAIG;IACU,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IAI/C;;OAEG;IACI,OAAO,IAAI,IAAI;CAMzB"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// #region Imports
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.PoFileReader = void 0;
|
|
5
|
-
const utilities_1 = require("@breadstone-infrastructure/utilities");
|
|
6
|
-
// #endregion
|
|
7
|
-
/**
|
|
8
|
-
* Class for reading `.po` files.
|
|
9
|
-
*
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
class PoFileReader {
|
|
13
|
-
// #region Fields
|
|
14
|
-
_fileReader;
|
|
15
|
-
// #endregion
|
|
16
|
-
// #region Ctor
|
|
17
|
-
/**
|
|
18
|
-
* Constructs a new instance of the `PoFileReader` class.
|
|
19
|
-
*
|
|
20
|
-
* @param filePath - The path to the `.po` file.
|
|
21
|
-
*/
|
|
22
|
-
constructor(filePath) {
|
|
23
|
-
this._fileReader = new utilities_1.TextFileReader(filePath);
|
|
24
|
-
}
|
|
25
|
-
// #endregion
|
|
26
|
-
// #region Methods
|
|
27
|
-
/**
|
|
28
|
-
* Reads the entire content of the `.po` file.
|
|
29
|
-
*
|
|
30
|
-
* @returns A promise resolving to the file content as a string.
|
|
31
|
-
*/
|
|
32
|
-
async readFileContent() {
|
|
33
|
-
return this._fileReader.readToEnd();
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Disposes the underlying file reader.
|
|
37
|
-
*/
|
|
38
|
-
dispose() {
|
|
39
|
-
this._fileReader.dispose();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.PoFileReader = PoFileReader;
|
|
43
|
-
//# sourceMappingURL=PoFileReader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PoFileReader.js","sourceRoot":"","sources":["../../src/Resources/PoFileReader.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAElB,oEAAwF;AAExF,aAAa;AAEb;;;;GAIG;AACH,MAAa,YAAY;IAErB,iBAAiB;IAEA,WAAW,CAAc;IAE1C,aAAa;IAEb,eAAe;IAEf;;;;OAIG;IACH,YAAmB,QAAgB;QAC/B,IAAI,CAAC,WAAW,GAAG,IAAI,0BAAc,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC;IAED,aAAa;IAEb,kBAAkB;IAElB;;;;OAIG;IACI,KAAK,CAAC,eAAe;QACxB,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC;IACxC,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;IAC/B,CAAC;CAIJ;AAzCD,oCAyCC"}
|