invenio-app-rdm 13.0.0rc2__py2.py3-none-any.whl → 13.0.0rc4__py2.py3-none-any.whl
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.
- invenio_app_rdm/__init__.py +1 -1
- invenio_app_rdm/config.py +14 -1
- invenio_app_rdm/ext.py +2 -2
- invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/deposit.html +5 -0
- invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/detail.html +1 -1
- invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/detail.html +1 -1
- invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/files.html +20 -3
- invenio_app_rdm/records_ui/views/deposits.py +11 -5
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/components/ImpersonateUserForm.js +12 -17
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/components/SetQuotaAction.js +1 -1
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/communityRecordsSearch/CommunityRecordsSearchAppLayout.js +3 -4
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/RDMDepositForm.js +6 -1
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/index.js +1 -0
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/RecordVersionsList.js +16 -17
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/RemoveFromCommunity/RemoveFromCommunityAction.js +5 -5
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/search/components.js +13 -18
- invenio_app_rdm/theme/assets/semantic-ui/less/invenio_app_rdm/file_uploader/uppy.less +37 -0
- invenio_app_rdm/theme/assets/semantic-ui/less/invenio_app_rdm/theme/modules/accordion.overrides +9 -0
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/i18next-scanner.config.js +1 -1
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/i18next.js +1 -1
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/_generatedTranslations.js +66 -0
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ar/messages.po +804 -137
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ar/translations.json +277 -249
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/bg/messages.po +689 -70
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/bg/translations.json +102 -82
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ca/messages.po +699 -80
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ca/translations.json +112 -92
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/cs/messages.po +821 -138
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/cs/translations.json +290 -262
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/da/messages.po +691 -66
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/da/translations.json +91 -71
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/de/messages.po +818 -138
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/de/translations.json +260 -240
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/el/messages.po +698 -78
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/el/translations.json +108 -88
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/en/messages.po +1000 -5
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/en/translations.json +81 -28
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/es/messages.po +810 -137
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/es/translations.json +253 -233
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/et/messages.po +746 -133
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/et/translations.json +130 -110
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/fa/messages.po +688 -69
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/fa/translations.json +103 -79
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/fr/messages.po +809 -126
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/fr/translations.json +277 -257
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/hr/messages.po +695 -70
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/hr/translations.json +101 -79
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/hu/messages.po +801 -135
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/hu/translations.json +254 -234
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/index.js +16 -65
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/it/messages.po +712 -86
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/it/translations.json +116 -96
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ja/messages.po +683 -70
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ja/translations.json +96 -78
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ka/messages.po +689 -70
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ka/translations.json +109 -85
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ko/messages.po +889 -0
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ko/translations.json +277 -0
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/lt/messages.po +702 -71
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/lt/translations.json +113 -85
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/no/messages.po +689 -70
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/no/translations.json +102 -82
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/pl/messages.po +704 -70
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/pl/translations.json +119 -91
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/pt/messages.po +694 -69
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/pt/translations.json +93 -73
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ro/messages.po +717 -85
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ro/translations.json +155 -133
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ru/messages.po +806 -124
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ru/translations.json +288 -260
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/sk/messages.po +713 -82
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/sk/translations.json +119 -91
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/sv/messages.po +807 -141
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/sv/translations.json +260 -240
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/tr/messages.po +799 -128
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/tr/translations.json +259 -239
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/uk/messages.po +756 -131
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/uk/translations.json +124 -96
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/zh_CN/messages.po +736 -123
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/zh_CN/translations.json +130 -108
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/zh_TW/messages.po +683 -70
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/zh_TW/translations.json +100 -78
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/package-lock.json +1295 -678
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/package.json +3 -37
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/scripts/compileCatalog.js +102 -24
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/scripts/fixTrailingNewlines.js +23 -0
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/scripts/initCatalog.js +1 -1
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/scripts/postExtractMessages.js +36 -0
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/translations.pot +243 -94
- invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/intro_section.html +7 -6
- invenio_app_rdm/theme/webpack.py +1 -0
- invenio_app_rdm/translations/ar/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/ar/LC_MESSAGES/messages.po +972 -376
- invenio_app_rdm/translations/bg/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/bg/LC_MESSAGES/messages.po +907 -278
- invenio_app_rdm/translations/ca/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/ca/LC_MESSAGES/messages.po +912 -283
- invenio_app_rdm/translations/cs/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/cs/LC_MESSAGES/messages.po +1069 -405
- invenio_app_rdm/translations/da/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/da/LC_MESSAGES/messages.po +908 -273
- invenio_app_rdm/translations/de/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/de/LC_MESSAGES/messages.po +1017 -406
- invenio_app_rdm/translations/el/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/el/LC_MESSAGES/messages.po +915 -286
- invenio_app_rdm/translations/es/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/es/LC_MESSAGES/messages.po +963 -371
- invenio_app_rdm/translations/et/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/et/LC_MESSAGES/messages.po +938 -362
- invenio_app_rdm/translations/fa/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/fa/LC_MESSAGES/messages.po +906 -277
- invenio_app_rdm/translations/fr/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/fr/LC_MESSAGES/messages.po +1032 -375
- invenio_app_rdm/translations/hr/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/hr/LC_MESSAGES/messages.po +907 -278
- invenio_app_rdm/translations/hu/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/hu/LC_MESSAGES/messages.po +985 -369
- invenio_app_rdm/translations/it/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/it/LC_MESSAGES/messages.po +928 -298
- invenio_app_rdm/translations/ja/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/ja/LC_MESSAGES/messages.po +907 -278
- invenio_app_rdm/translations/ka/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/ka/LC_MESSAGES/messages.po +909 -280
- invenio_app_rdm/translations/ko/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/ko/LC_MESSAGES/messages.po +1361 -0
- invenio_app_rdm/translations/lt/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/lt/LC_MESSAGES/messages.po +910 -281
- invenio_app_rdm/translations/messages.pot +486 -303
- invenio_app_rdm/translations/no/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/no/LC_MESSAGES/messages.po +907 -278
- invenio_app_rdm/translations/pl/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/pl/LC_MESSAGES/messages.po +907 -278
- invenio_app_rdm/translations/pt/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/pt/LC_MESSAGES/messages.po +906 -277
- invenio_app_rdm/translations/ro/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/ro/LC_MESSAGES/messages.po +1042 -384
- invenio_app_rdm/translations/ru/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/ru/LC_MESSAGES/messages.po +1022 -370
- invenio_app_rdm/translations/sk/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/sk/LC_MESSAGES/messages.po +916 -287
- invenio_app_rdm/translations/sv/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/sv/LC_MESSAGES/messages.po +989 -380
- invenio_app_rdm/translations/tr/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/tr/LC_MESSAGES/messages.po +992 -341
- invenio_app_rdm/translations/uk/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/uk/LC_MESSAGES/messages.po +935 -356
- invenio_app_rdm/translations/zh_CN/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/zh_CN/LC_MESSAGES/messages.po +939 -347
- invenio_app_rdm/translations/zh_TW/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/zh_TW/LC_MESSAGES/messages.po +907 -278
- {invenio_app_rdm-13.0.0rc2.dist-info → invenio_app_rdm-13.0.0rc4.dist-info}/METADATA +27 -1
- {invenio_app_rdm-13.0.0rc2.dist-info → invenio_app_rdm-13.0.0rc4.dist-info}/RECORD +156 -148
- {invenio_app_rdm-13.0.0rc2.dist-info → invenio_app_rdm-13.0.0rc4.dist-info}/WHEEL +0 -0
- {invenio_app_rdm-13.0.0rc2.dist-info → invenio_app_rdm-13.0.0rc4.dist-info}/entry_points.txt +0 -0
- {invenio_app_rdm-13.0.0rc2.dist-info → invenio_app_rdm-13.0.0rc4.dist-info}/licenses/LICENSE +0 -0
- {invenio_app_rdm-13.0.0rc2.dist-info → invenio_app_rdm-13.0.0rc4.dist-info}/top_level.txt +0 -0
|
@@ -1,41 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "invenio-app-rdm-ui",
|
|
3
3
|
"config": {
|
|
4
|
-
"languages": [
|
|
5
|
-
"af",
|
|
6
|
-
"ar",
|
|
7
|
-
"bg",
|
|
8
|
-
"ca",
|
|
9
|
-
"cs",
|
|
10
|
-
"da",
|
|
11
|
-
"de",
|
|
12
|
-
"el",
|
|
13
|
-
"en",
|
|
14
|
-
"es",
|
|
15
|
-
"et",
|
|
16
|
-
"et_EE",
|
|
17
|
-
"fa",
|
|
18
|
-
"fr",
|
|
19
|
-
"gl",
|
|
20
|
-
"hr",
|
|
21
|
-
"hu",
|
|
22
|
-
"it",
|
|
23
|
-
"ja",
|
|
24
|
-
"ka",
|
|
25
|
-
"lt",
|
|
26
|
-
"no",
|
|
27
|
-
"pl",
|
|
28
|
-
"pt",
|
|
29
|
-
"ro",
|
|
30
|
-
"ru",
|
|
31
|
-
"rw",
|
|
32
|
-
"sk",
|
|
33
|
-
"sv",
|
|
34
|
-
"tr",
|
|
35
|
-
"uk",
|
|
36
|
-
"zh_CN",
|
|
37
|
-
"zh_TW"
|
|
38
|
-
]
|
|
4
|
+
"languages": ["en"]
|
|
39
5
|
},
|
|
40
6
|
"devDependencies": {
|
|
41
7
|
"i18next-conv": "^10.2.0",
|
|
@@ -44,8 +10,8 @@
|
|
|
44
10
|
"react-json-view": "^1.21.3"
|
|
45
11
|
},
|
|
46
12
|
"scripts": {
|
|
47
|
-
"extract_messages": "i18next-scanner --config i18next-scanner.config.js '../../js/**/*.{js,jsx}'",
|
|
48
|
-
"postextract_messages": "
|
|
13
|
+
"extract_messages": "i18next-scanner --config i18next-scanner.config.js '../../js/**/*.{js,jsx}' '!../../js/**/node_modules/**'",
|
|
14
|
+
"postextract_messages": "node ./scripts/postExtractMessages.js",
|
|
49
15
|
"compile_catalog": "node ./scripts/compileCatalog.js",
|
|
50
16
|
"init_catalog": "node ./scripts/initCatalog"
|
|
51
17
|
}
|
invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/scripts/compileCatalog.js
CHANGED
|
@@ -1,40 +1,118 @@
|
|
|
1
|
-
// This file is part of
|
|
2
|
-
// Copyright (C) 2021 Graz University of Technology.
|
|
1
|
+
// This file is part of invenio-app-rdm.
|
|
2
|
+
// Copyright (C) 2021-2024 Graz University of Technology.
|
|
3
|
+
// Copyright (C) 2025 KTH Royal Institute of Technology.
|
|
3
4
|
//
|
|
4
5
|
// Invenio-app-rdm is free software; you can redistribute it and/or modify it
|
|
5
6
|
// under the terms of the MIT License; see LICENSE file for more details.
|
|
6
7
|
|
|
7
|
-
const { readFileSync, writeFileSync } = require("fs");
|
|
8
|
+
const { readdirSync, readFileSync, writeFileSync, existsSync } = require("fs");
|
|
8
9
|
const { gettextToI18next } = require("i18next-conv");
|
|
10
|
+
const path = require("path");
|
|
9
11
|
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
+
const PACKAGE_MESSAGES_PATH = "./messages";
|
|
13
|
+
const PO_FILENAME = "messages.po";
|
|
14
|
+
const JSON_FILENAME = "translations.json";
|
|
15
|
+
const GENERATED_FILE = "_generatedTranslations.js";
|
|
12
16
|
|
|
13
17
|
// it accepts the same options as the cli.
|
|
14
18
|
// https://github.com/i18next/i18next-gettext-converter#options
|
|
15
19
|
const options = {
|
|
16
|
-
/*
|
|
20
|
+
/* your options here */
|
|
17
21
|
};
|
|
18
22
|
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
async function compileAndCreateFileForLanguage(parentPath, lang) {
|
|
24
|
+
const poFilePath = path.join(parentPath, lang, PO_FILENAME);
|
|
25
|
+
const jsonFilePath = path.join(parentPath, lang, JSON_FILENAME);
|
|
26
|
+
|
|
27
|
+
if (!existsSync(poFilePath)) {
|
|
28
|
+
console.warn(`❌ Skipping ${lang}: ${PO_FILENAME} not found.`);
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
const poContent = readFileSync(poFilePath);
|
|
34
|
+
const result = await gettextToI18next(lang, poContent, options);
|
|
35
|
+
const parsed = JSON.parse(result);
|
|
36
|
+
const prettyJSON = JSON.stringify(parsed, null, 2) + "\n";
|
|
37
|
+
writeFileSync(jsonFilePath, prettyJSON);
|
|
38
|
+
console.log(`✅ Successfully converted ${lang}/${PO_FILENAME} to ${JSON_FILENAME}`);
|
|
39
|
+
return true;
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.error(`❌ Error processing ${lang}:`, error.message);
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function writeGeneratedTranslationsFile(languages) {
|
|
47
|
+
const generatedPath = path.join(PACKAGE_MESSAGES_PATH, GENERATED_FILE);
|
|
48
|
+
let content = "// AUTO-GENERATED FILE - DO NOT EDIT MANUALLY\n";
|
|
49
|
+
content += "// This file exports all available translations for i18next\n\n";
|
|
50
|
+
|
|
51
|
+
// Generate imports
|
|
52
|
+
languages.forEach((lang) => {
|
|
53
|
+
const varName = lang.toUpperCase().replace(/-/g, "_");
|
|
54
|
+
content += `import TRANSLATE_${varName} from "./${lang}/${JSON_FILENAME}";\n`;
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Generate exports
|
|
58
|
+
content += "\nexport const translations = {\n";
|
|
59
|
+
languages.forEach((lang) => {
|
|
60
|
+
const varName = lang.toUpperCase().replace(/-/g, "_");
|
|
61
|
+
content += ` ${lang}: { translation: TRANSLATE_${varName} },\n`;
|
|
62
|
+
});
|
|
63
|
+
content += "};\n";
|
|
64
|
+
|
|
65
|
+
writeFileSync(generatedPath, content);
|
|
66
|
+
console.log(`📁 Generated translation index at ${GENERATED_FILE}`);
|
|
23
67
|
}
|
|
24
68
|
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
for (const lang of
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
readFileSync(`${PACKAGE_JSON_BASE_PATH}messages/${lang}/messages.po`),
|
|
37
|
-
options
|
|
38
|
-
).then(save(`${PACKAGE_JSON_BASE_PATH}messages/${lang}/translations.json`));
|
|
69
|
+
async function processAllLanguages() {
|
|
70
|
+
const directories = readdirSync(PACKAGE_MESSAGES_PATH, {
|
|
71
|
+
withFileTypes: true,
|
|
72
|
+
})
|
|
73
|
+
.filter((dir) => dir.isDirectory())
|
|
74
|
+
.map((dir) => dir.name);
|
|
75
|
+
|
|
76
|
+
const processedLangs = [];
|
|
77
|
+
for (const lang of directories) {
|
|
78
|
+
const success = await compileAndCreateFileForLanguage(PACKAGE_MESSAGES_PATH, lang);
|
|
79
|
+
if (success) processedLangs.push(lang);
|
|
39
80
|
}
|
|
81
|
+
return processedLangs;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function handleLanguageCommand(lang) {
|
|
85
|
+
const success = await compileAndCreateFileForLanguage(PACKAGE_MESSAGES_PATH, lang);
|
|
86
|
+
if (!success) process.exit(1);
|
|
87
|
+
|
|
88
|
+
const directories = readdirSync(PACKAGE_MESSAGES_PATH, {
|
|
89
|
+
withFileTypes: true,
|
|
90
|
+
})
|
|
91
|
+
.filter((dir) => dir.isDirectory())
|
|
92
|
+
.map((dir) => dir.name);
|
|
93
|
+
|
|
94
|
+
const validLangs = directories.filter((l) =>
|
|
95
|
+
existsSync(path.join(PACKAGE_MESSAGES_PATH, l, JSON_FILENAME))
|
|
96
|
+
);
|
|
97
|
+
writeGeneratedTranslationsFile(validLangs);
|
|
40
98
|
}
|
|
99
|
+
|
|
100
|
+
// Main execution flow
|
|
101
|
+
// self-executing function for coordinating async on the top level
|
|
102
|
+
// and to avoid using .then() and .catch().
|
|
103
|
+
// operations with centralized error handling.
|
|
104
|
+
(async () => {
|
|
105
|
+
try {
|
|
106
|
+
if (process.argv[2] === "lang") {
|
|
107
|
+
const lang = process.argv[3];
|
|
108
|
+
if (!lang) throw new Error("Missing language code e.g. 'sv', 'ar', etc.");
|
|
109
|
+
await handleLanguageCommand(lang);
|
|
110
|
+
} else {
|
|
111
|
+
const processedLangs = await processAllLanguages();
|
|
112
|
+
writeGeneratedTranslationsFile(processedLangs);
|
|
113
|
+
}
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.error("❌ Script failed:", error.message);
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
})();
|
invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/scripts/fixTrailingNewlines.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// This file is part of invenio-app-rdm.
|
|
2
|
+
// Copyright (C) 2025 CERN.
|
|
3
|
+
// Copyright (C) 2025 KTH Royal Institute of Technology.
|
|
4
|
+
//
|
|
5
|
+
// Invenio-app-rdm is free software; you can redistribute it and/or modify it
|
|
6
|
+
// under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
+
|
|
8
|
+
const fs = require("fs");
|
|
9
|
+
|
|
10
|
+
const files = ["./translations.pot", "./messages/en/messages.po"];
|
|
11
|
+
|
|
12
|
+
for (const file of files) {
|
|
13
|
+
if (!fs.existsSync(file)) {
|
|
14
|
+
console.warn(`⚠️ File not found: ${file}`);
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const content = fs.readFileSync(file, "utf8");
|
|
19
|
+
if (!content.endsWith("\n")) {
|
|
20
|
+
fs.appendFileSync(file, "\n");
|
|
21
|
+
console.log(`🔧 Appended trailing newline to: ${file}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/scripts/postExtractMessages.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// This file is part of invenio-app-rdm.
|
|
2
|
+
// Copyright (C) 2025 KTH Royal Institute of Technology.
|
|
3
|
+
//
|
|
4
|
+
// invenio-app-rdm is free software; you can redistribute it and/or modify it
|
|
5
|
+
// under the terms of the MIT License; see LICENSE file for more details.
|
|
6
|
+
|
|
7
|
+
const { execSync } = require("child_process");
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Post-processing script for extracted messages
|
|
11
|
+
* Converts translations.json to .pot and .po formats and fixes trailing newlines
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const commands = [
|
|
15
|
+
// Convert to .pot format
|
|
16
|
+
"i18next-conv -l en -s ./messages/en/translations.json -t ./translations.pot",
|
|
17
|
+
// Convert to .po format
|
|
18
|
+
"i18next-conv -l en -s ./messages/en/translations.json -t ./messages/en/messages.po",
|
|
19
|
+
// Fix trailing newlines
|
|
20
|
+
"node scripts/fixTrailingNewlines.js",
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
console.log("📝 Post-processing extracted messages...");
|
|
24
|
+
|
|
25
|
+
commands.forEach((command, index) => {
|
|
26
|
+
try {
|
|
27
|
+
console.log(`⚙️ Step ${index + 1}/${commands.length}: ${command}`);
|
|
28
|
+
execSync(command, { stdio: "inherit", cwd: process.cwd() });
|
|
29
|
+
} catch (error) {
|
|
30
|
+
console.error(`❌ Failed to execute: ${command}`);
|
|
31
|
+
console.error(error.message);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
console.log("✅ Post-processing completed successfully!");
|