@dhis2/cli-app 5.2.0-alpha.9 → 5.2.1-alpha.1
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/package.json +2 -2
- package/src/commands/i18n.js +1 -1
- package/src/helpers/modernize/checkRequirements.js +1 -1
- package/src/helpers/modernize/createNewTranslationFiles.js +2 -2
- package/src/helpers/modernize/deleteLegacyFiles.js +1 -1
- package/src/helpers/modernize/generateTranslationMappings.js +1 -1
- package/src/helpers/modernize/getTemplates.js +1 -1
- package/src/helpers/modernize/getTranslationFileNames.js +1 -1
- package/src/helpers/modernize/splitTranslation.js +2 -2
- package/src/index.js +1 -1
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=12"
|
|
8
8
|
},
|
|
9
|
-
"version": "5.2.
|
|
9
|
+
"version": "5.2.1-alpha.1",
|
|
10
10
|
"main": "src/index.js",
|
|
11
11
|
"author": "Austin McGee <austin@dhis2.org>",
|
|
12
12
|
"contributors": [
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"license": "BSD-3-Clause",
|
|
16
16
|
"private": false,
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@dhis2/cli-app-scripts": "
|
|
18
|
+
"@dhis2/cli-app-scripts": "alpha",
|
|
19
19
|
"@dhis2/cli-helpers-engine": "^3.2.1"
|
|
20
20
|
},
|
|
21
21
|
"publishConfig": {
|
package/src/commands/i18n.js
CHANGED
|
@@ -43,7 +43,7 @@ const checkMainTranslationFilePresent = (
|
|
|
43
43
|
primaryLanguage,
|
|
44
44
|
translationFiles
|
|
45
45
|
) => {
|
|
46
|
-
const mainTranslationFile = translationFiles.find(file =>
|
|
46
|
+
const mainTranslationFile = translationFiles.find((file) =>
|
|
47
47
|
file.match(`i18n_module_${primaryLanguage}.properties`)
|
|
48
48
|
)
|
|
49
49
|
const mainTranslationFilePath = path.join(inDir, mainTranslationFile)
|
|
@@ -115,7 +115,7 @@ const createNewTranslationFiles = ({
|
|
|
115
115
|
} else {
|
|
116
116
|
newContents += `msgid ""\n`
|
|
117
117
|
const newLines = splitTranslation(originalTranslation)
|
|
118
|
-
newLines.forEach(translationPart => {
|
|
118
|
+
newLines.forEach((translationPart) => {
|
|
119
119
|
newContents += `"${unescape(translationPart)}"\n`
|
|
120
120
|
})
|
|
121
121
|
}
|
|
@@ -125,7 +125,7 @@ const createNewTranslationFiles = ({
|
|
|
125
125
|
} else {
|
|
126
126
|
newContents += `msgstr ""\n`
|
|
127
127
|
const newLines = splitTranslation(translation)
|
|
128
|
-
newLines.forEach(translationPart => {
|
|
128
|
+
newLines.forEach((translationPart) => {
|
|
129
129
|
newContents += `"${unescape(translationPart)}"\n`
|
|
130
130
|
})
|
|
131
131
|
}
|
|
@@ -8,7 +8,7 @@ const { reporter } = require('@dhis2/cli-helpers-engine')
|
|
|
8
8
|
* @returns {void}
|
|
9
9
|
*/
|
|
10
10
|
const deleteLegacyFiles = ({ translationFiles, languagesToTransform }) => {
|
|
11
|
-
translationFiles.forEach(file => {
|
|
11
|
+
translationFiles.forEach((file) => {
|
|
12
12
|
const language = file.replace(/i18n_module_|.properties/g, '')
|
|
13
13
|
|
|
14
14
|
if (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const fs = require('fs')
|
|
2
2
|
const path = require('path')
|
|
3
3
|
|
|
4
|
-
const getTemplateMainLanguage = creationDate => {
|
|
4
|
+
const getTemplateMainLanguage = (creationDate) => {
|
|
5
5
|
const template = fs.readFileSync(
|
|
6
6
|
path.join(__dirname, 'main_language.template'),
|
|
7
7
|
{ encoding: 'utf8' }
|
|
@@ -4,7 +4,7 @@ const {
|
|
|
4
4
|
checkMainTranslationFilePresent,
|
|
5
5
|
} = require('./checkRequirements')
|
|
6
6
|
|
|
7
|
-
const fileIsOldTranslationFile = fileName => fileName.match(/\.properties$/)
|
|
7
|
+
const fileIsOldTranslationFile = (fileName) => fileName.match(/\.properties$/)
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @param {Object} args
|
|
@@ -7,7 +7,7 @@ const LENGTH_TO_SPLIT_LINE_AT = 77
|
|
|
7
7
|
* The translation needs to be split by whitespaces first in order to create the
|
|
8
8
|
* correct structure of the new translation
|
|
9
9
|
*/
|
|
10
|
-
const splitTranslation = translation =>
|
|
10
|
+
const splitTranslation = (translation) =>
|
|
11
11
|
translation.split(' ').reduce((parts, curSplit) => {
|
|
12
12
|
const latestPart = parts[parts.length - 1]
|
|
13
13
|
const latestPartEscaped = escape(latestPart)
|
|
@@ -27,7 +27,7 @@ const splitTranslation = translation =>
|
|
|
27
27
|
return parts
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
curSplitEscaped.match(/.{1,76}(?=(%5Cu))?/g).forEach(escapedSplit => {
|
|
30
|
+
curSplitEscaped.match(/.{1,76}(?=(%5Cu))?/g).forEach((escapedSplit) => {
|
|
31
31
|
parts.push(unescape(escapedSplit))
|
|
32
32
|
})
|
|
33
33
|
|
package/src/index.js
CHANGED
|
@@ -2,7 +2,7 @@ const { namespace, createModuleLoader } = require('@dhis2/cli-helpers-engine')
|
|
|
2
2
|
|
|
3
3
|
module.exports = namespace('app', {
|
|
4
4
|
description: 'Front-end application and library commands',
|
|
5
|
-
builder: yargs => {
|
|
5
|
+
builder: (yargs) => {
|
|
6
6
|
const loader = createModuleLoader({
|
|
7
7
|
parentModule: __filename,
|
|
8
8
|
})
|