@windward/core 0.0.7 → 0.0.9
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/components/Content/Blocks/ClickableIcons.vue +128 -40
- package/components/Content/Blocks/Image.vue +37 -10
- package/components/Content/Blocks/OpenResponse.vue +32 -10
- package/components/Content/Blocks/OpenResponseCollate.vue +69 -42
- package/components/Content/Blocks/ScenarioChoice.vue +262 -0
- package/components/Content/Blocks/Tab.vue +2 -7
- package/components/Settings/AccordionSettings.vue +97 -74
- package/components/Settings/ClickableIconsSettings.vue +101 -86
- package/components/Settings/ImageSettings.vue +10 -0
- package/components/Settings/OpenResponseCollateSettings.vue +9 -8
- package/components/Settings/ScenarioChoiceSettings.vue +329 -0
- package/components/Settings/TabSettings.vue +75 -61
- package/components/Settings/TextEditorSettings.vue +2 -3
- package/components/utils/FillInBlank/FillInBlankInput.vue +4 -1
- package/components/utils/TinyMCEWrapper.vue +11 -4
- package/components/utils/assets/tinymce/css/content.scss +1 -1
- package/helpers/FillInBlankHelper.ts +0 -2
- package/helpers/tinymce/plugin.ts +1 -1
- package/i18n/en-US/components/content/blocks/index.ts +2 -2
- package/i18n/en-US/components/content/blocks/open_response_collate.ts +1 -0
- package/i18n/en-US/components/content/blocks/scenario_choice.ts +5 -0
- package/i18n/en-US/components/settings/accordion.ts +5 -0
- package/i18n/en-US/components/settings/clickable_icon.ts +8 -0
- package/i18n/en-US/components/settings/image.ts +3 -1
- package/i18n/en-US/components/settings/index.ts +6 -0
- package/i18n/en-US/components/settings/scenario_choice.ts +19 -0
- package/i18n/en-US/components/settings/tab.ts +7 -0
- package/i18n/en-US/components/utils/FillInBlank/FillInBlankInput.ts +1 -1
- package/i18n/en-US/shared/content_blocks.ts +1 -0
- package/i18n/en-US/shared/settings.ts +2 -0
- package/i18n/es-ES/components/content/blocks/feedback.ts +2 -0
- package/i18n/es-ES/components/content/blocks/index.ts +2 -2
- package/i18n/es-ES/components/content/blocks/open_response_collate.ts +1 -0
- package/i18n/es-ES/components/content/blocks/scenario_choice.ts +6 -0
- package/i18n/es-ES/components/navigation/index.ts +2 -0
- package/i18n/es-ES/components/settings/accordion.ts +5 -0
- package/i18n/es-ES/components/settings/clickable_icon.ts +8 -0
- package/i18n/es-ES/components/settings/image.ts +3 -1
- package/i18n/es-ES/components/settings/index.ts +6 -0
- package/i18n/es-ES/components/settings/scenario_choice.ts +19 -0
- package/i18n/es-ES/components/{content/blocks → settings}/tab.ts +3 -0
- package/i18n/es-ES/components/utils/FillInBlank/FillInBlankInput.ts +13 -0
- package/i18n/es-ES/components/utils/FillInBlank/FillInTheBlanksManager.ts +11 -0
- package/i18n/es-ES/components/utils/FillInBlank/index.ts +6 -0
- package/i18n/es-ES/components/utils/index.ts +2 -0
- package/i18n/es-ES/components/utils/tiny_mce_wrapper.ts +1 -0
- package/i18n/es-ES/shared/content_blocks.ts +1 -0
- package/i18n/es-ES/shared/menu.ts +1 -0
- package/i18n/es-ES/shared/settings.ts +2 -0
- package/i18n/index.ts +11 -0
- package/i18n/sv-SE/components/content/blocks/feedback.ts +2 -0
- package/i18n/sv-SE/components/content/blocks/index.ts +2 -2
- package/i18n/sv-SE/components/content/blocks/open_response_collate.ts +1 -0
- package/i18n/sv-SE/components/content/blocks/scenario_choice.ts +5 -0
- package/i18n/sv-SE/components/navigation/index.ts +2 -0
- package/i18n/sv-SE/components/settings/accordion.ts +5 -0
- package/i18n/sv-SE/components/settings/clickable_icon.ts +8 -0
- package/i18n/sv-SE/components/settings/image.ts +3 -1
- package/i18n/sv-SE/components/settings/index.ts +6 -0
- package/i18n/sv-SE/components/settings/scenario_choice.ts +19 -0
- package/i18n/sv-SE/components/{content/blocks → settings}/tab.ts +3 -0
- package/i18n/sv-SE/components/utils/FillInBlank/FillInBlankInput.ts +13 -0
- package/i18n/sv-SE/components/utils/FillInBlank/FillInTheBlanksManager.ts +11 -0
- package/i18n/sv-SE/components/utils/FillInBlank/index.ts +6 -0
- package/i18n/sv-SE/components/utils/index.ts +2 -0
- package/i18n/sv-SE/components/utils/tiny_mce_wrapper.ts +1 -0
- package/i18n/sv-SE/shared/content_blocks.ts +1 -0
- package/i18n/sv-SE/shared/menu.ts +1 -0
- package/i18n/sv-SE/shared/settings.ts +2 -0
- package/package.json +2 -1
- package/plugin.js +24 -5
- package/test/Components/Content/Blocks/ScenarioChoice.spec.js +21 -0
- package/test/Components/Settings/ClickableIconsSettings.spec.js +1 -1
- package/test/Components/Settings/ScenarioChoiceSettings.spec.js +20 -0
- package/test/Feature/LocaleKeys.spec.js +9 -0
- package/test/__mocks__/componentsMock.js +24 -0
- package/test/__mocks__/helpersMock.js +3 -0
- package/test/__mocks__/modelMock.js +4 -0
- package/test/locales.js +95 -0
- package/i18n/en-US/components/content/blocks/tab.ts +0 -4
|
@@ -10,10 +10,12 @@ export default {
|
|
|
10
10
|
text_editor: 'Configuración del editor de texto',
|
|
11
11
|
clickable_icons:
|
|
12
12
|
'Configuración de iconos en los que se puede hacer clic',
|
|
13
|
+
scenario_choice: 'Elección de escenario',
|
|
13
14
|
accordion: 'Configuración de acordeón',
|
|
14
15
|
video: 'Configuración de vídeo',
|
|
15
16
|
table: 'Configuración de la tabla',
|
|
16
17
|
math: 'Configuración matemática',
|
|
17
18
|
feedback: 'Configuración de comentarios',
|
|
19
|
+
title: 'Título',
|
|
18
20
|
},
|
|
19
21
|
}
|
package/i18n/index.ts
ADDED
|
@@ -4,6 +4,8 @@ export default {
|
|
|
4
4
|
module: 'Modul',
|
|
5
5
|
preset: 'Förinställningar',
|
|
6
6
|
likert: 'Lägg till standard likert-frågor',
|
|
7
|
+
likert_directions:
|
|
8
|
+
'Klicka för att välja det första alternativet och använd sedan fliken för att växla knappgrupper och sedan pilarna för att navigera mellan alternativen.',
|
|
7
9
|
contact_mindedge: 'Kontakta Mindedge fråga',
|
|
8
10
|
open_response: 'Öppet svar',
|
|
9
11
|
response_prompt: 'Ge kursfeedback nedan',
|
|
@@ -2,18 +2,18 @@ import user_upload from './user_upload'
|
|
|
2
2
|
import image from './image'
|
|
3
3
|
import video from './video'
|
|
4
4
|
import table from './table'
|
|
5
|
-
import tab from './tab'
|
|
6
5
|
import feedback from './feedback'
|
|
7
6
|
import open_response from './open_response'
|
|
8
7
|
import open_response_collate from './open_response_collate'
|
|
8
|
+
import scenarioChoice from './scenario_choice'
|
|
9
9
|
|
|
10
10
|
export default {
|
|
11
11
|
user_upload,
|
|
12
12
|
image,
|
|
13
13
|
video,
|
|
14
14
|
table,
|
|
15
|
-
tab,
|
|
16
15
|
feedback,
|
|
17
16
|
open_response,
|
|
18
17
|
open_response_collate,
|
|
18
|
+
scenario_choice: scenarioChoice,
|
|
19
19
|
}
|
|
@@ -3,8 +3,16 @@ export default {
|
|
|
3
3
|
description: 'Description',
|
|
4
4
|
information:
|
|
5
5
|
'Klicka på vart och ett av listobjekten nedan för mer information.',
|
|
6
|
+
no_icon: 'Ingen ikon',
|
|
6
7
|
item_icon: 'Artikel {0} icon',
|
|
7
8
|
item_title: 'Artikeltitel',
|
|
8
9
|
item_color: 'Artikelfärg',
|
|
9
10
|
item_text: 'Artikeltext',
|
|
11
|
+
autocolor: 'Auto-färgalternativ',
|
|
12
|
+
display: {
|
|
13
|
+
show_title: 'Visa alltid titel',
|
|
14
|
+
show_background: 'Visa bakgrund',
|
|
15
|
+
round_icon: 'Runda ikoner',
|
|
16
|
+
italic_icon: 'Kursiva ikoner',
|
|
17
|
+
},
|
|
10
18
|
}
|
|
@@ -5,13 +5,19 @@ import video from './video'
|
|
|
5
5
|
import clickable_icon from './clickable_icon'
|
|
6
6
|
import open_response from './open_response'
|
|
7
7
|
import open_response_collate from './open_response_collate'
|
|
8
|
+
import scenarioChoice from './scenario_choice'
|
|
9
|
+
import accordion from './accordion'
|
|
10
|
+
import tab from './tab'
|
|
8
11
|
|
|
9
12
|
export default {
|
|
13
|
+
accordion,
|
|
10
14
|
image,
|
|
11
15
|
user_upload,
|
|
12
16
|
text_editor,
|
|
17
|
+
tab,
|
|
13
18
|
video,
|
|
14
19
|
clickable_icon,
|
|
15
20
|
open_response,
|
|
16
21
|
open_response_collate,
|
|
22
|
+
scenario_choice: scenarioChoice,
|
|
17
23
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
title: 'Titel',
|
|
3
|
+
description: 'Beskrivning',
|
|
4
|
+
over_item_limit: 'Kan inte lägga till fler objekt',
|
|
5
|
+
no_title: 'Ingen titel',
|
|
6
|
+
item_title: 'Artikeltitel',
|
|
7
|
+
item_text: 'Artikeltext',
|
|
8
|
+
correct_choice: 'Är rätt val',
|
|
9
|
+
show_reset: 'Tillåt återförsök',
|
|
10
|
+
display_style: 'Visa stil',
|
|
11
|
+
is_linked: 'Blockera länkar till en sida',
|
|
12
|
+
link_content: 'Länkinnehåll',
|
|
13
|
+
link_text: 'Länktext',
|
|
14
|
+
link_required: 'Länktext och målsida krävs',
|
|
15
|
+
style: {
|
|
16
|
+
letter: 'Brev',
|
|
17
|
+
number: 'Nummer',
|
|
18
|
+
},
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
add_answer: 'Lägg till svar',
|
|
3
|
+
answer: 'Svar',
|
|
4
|
+
check: 'Kontrollera',
|
|
5
|
+
check_answer: 'Klicka för att kontrollera svar',
|
|
6
|
+
close: 'Stäng',
|
|
7
|
+
correct: 'Korrekt',
|
|
8
|
+
default_description: 'Din inmatning är korrekt',
|
|
9
|
+
incorrect: 'Inkorrekt',
|
|
10
|
+
input_incorrect: "'{0}' är felaktig",
|
|
11
|
+
reset: 'återställ',
|
|
12
|
+
try_again: 'Try Again',
|
|
13
|
+
}
|
|
@@ -8,10 +8,12 @@ export default {
|
|
|
8
8
|
tab_settings: 'Flikinställningar',
|
|
9
9
|
text_editor: 'Textredigeringsinställningar',
|
|
10
10
|
clickable_icons: 'Inställningar för klickbara ikoner',
|
|
11
|
+
scenario_choice: 'Scenarioval',
|
|
11
12
|
accordion: 'Accordion Settings',
|
|
12
13
|
video: 'Videoinställningar',
|
|
13
14
|
table: 'Tabellinställningar',
|
|
14
15
|
math: 'Matematiska inställningar',
|
|
15
16
|
feedback: 'Feedback-inställningar',
|
|
17
|
+
title: 'Titel',
|
|
16
18
|
},
|
|
17
19
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@windward/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "Windward UI Core Plugins",
|
|
5
5
|
"main": "plugin.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"@mindedge/vuetify-player": "^0.2.0",
|
|
20
20
|
"@tinymce/tinymce-vue": "^3.2.8",
|
|
21
21
|
"eslint": "^8.11.0",
|
|
22
|
+
"he": "^1.2.0",
|
|
22
23
|
"lodash": "^4.17.21",
|
|
23
24
|
"mathlive": "^0.73.7",
|
|
24
25
|
"mathml-to-latex": "^1.2.0",
|
package/plugin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import locales from './i18n'
|
|
2
2
|
|
|
3
3
|
// Content Blocks
|
|
4
4
|
import Video from './components/Content/Blocks/Video'
|
|
@@ -8,6 +8,7 @@ import MathExpressionEditor from './components/utils/MathExpressionEditor'
|
|
|
8
8
|
import Accordion from './components/Content/Blocks/Accordion'
|
|
9
9
|
import Feedback from './components/Content/Blocks/Feedback.vue'
|
|
10
10
|
import ClickableIcons from './components/Content/Blocks/ClickableIcons'
|
|
11
|
+
import ScenarioChoice from './components/Content/Blocks/ScenarioChoice'
|
|
11
12
|
|
|
12
13
|
import UserUploadNav from './components/Navigation/Items/UserUploadNav.vue'
|
|
13
14
|
|
|
@@ -27,6 +28,7 @@ import OpenResponseCollateSettings from './components/Settings/OpenResponseColla
|
|
|
27
28
|
import ImageSettings from './components/Settings/ImageSettings.vue'
|
|
28
29
|
import UserUploadSettings from './components/Settings/UserUploadSettings.vue'
|
|
29
30
|
import ClickableIconsSettings from './components/Settings/ClickableIconsSettings.vue'
|
|
31
|
+
import ScenarioChoiceSettings from './components/Settings/ScenarioChoiceSettings.vue'
|
|
30
32
|
import VideoSettings from './components/Settings/VideoSettings.vue'
|
|
31
33
|
import AccordionSettings from './components/Settings/AccordionSettings.vue'
|
|
32
34
|
import TabSettings from './components/Settings/TabSettings.vue'
|
|
@@ -52,9 +54,7 @@ export default {
|
|
|
52
54
|
onLoad: (page) => {},
|
|
53
55
|
onContent: () => {},
|
|
54
56
|
},
|
|
55
|
-
i18n:
|
|
56
|
-
'en-US': enUS,
|
|
57
|
-
},
|
|
57
|
+
i18n: locales.messages,
|
|
58
58
|
pages: [
|
|
59
59
|
{
|
|
60
60
|
page: 'user-uploads',
|
|
@@ -231,6 +231,16 @@ export default {
|
|
|
231
231
|
'windward.core.shared.content_blocks.grouping.basic',
|
|
232
232
|
},
|
|
233
233
|
},
|
|
234
|
+
{
|
|
235
|
+
tag: 'core-scenario-choice',
|
|
236
|
+
template: ScenarioChoice,
|
|
237
|
+
metadata: {
|
|
238
|
+
icon: 'mdi-ab-testing',
|
|
239
|
+
name: 'windward.core.shared.content_blocks.title.scenario_choice',
|
|
240
|
+
grouping:
|
|
241
|
+
'windward.core.shared.content_blocks.grouping.basic',
|
|
242
|
+
},
|
|
243
|
+
},
|
|
234
244
|
{
|
|
235
245
|
tag: 'core-feedback',
|
|
236
246
|
template: Feedback,
|
|
@@ -289,7 +299,7 @@ export default {
|
|
|
289
299
|
},
|
|
290
300
|
},
|
|
291
301
|
{
|
|
292
|
-
tag: 'core-clickable-
|
|
302
|
+
tag: 'core-clickable-icons-settings',
|
|
293
303
|
template: ClickableIconsSettings,
|
|
294
304
|
context: ['block.core-clickable-icons'],
|
|
295
305
|
metadata: {
|
|
@@ -297,6 +307,15 @@ export default {
|
|
|
297
307
|
name: 'windward.core.shared.settings.title.clickable_icons',
|
|
298
308
|
},
|
|
299
309
|
},
|
|
310
|
+
{
|
|
311
|
+
tag: 'core-scenario-choice-settings',
|
|
312
|
+
template: ScenarioChoiceSettings,
|
|
313
|
+
context: ['block.core-scenario-choice'],
|
|
314
|
+
metadata: {
|
|
315
|
+
icon: 'mdi-cog',
|
|
316
|
+
name: 'windward.core.shared.settings.title.scenario_choice',
|
|
317
|
+
},
|
|
318
|
+
},
|
|
300
319
|
{
|
|
301
320
|
tag: 'core-video-settings',
|
|
302
321
|
template: VideoSettings,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils'
|
|
2
|
+
import Vue from 'vue'
|
|
3
|
+
import Vuetify from 'vuetify'
|
|
4
|
+
|
|
5
|
+
import { defaultMocks } from '@/test/mocks'
|
|
6
|
+
import ScenarioChoice from '@/components/Content/Blocks/ScenarioChoice'
|
|
7
|
+
|
|
8
|
+
Vue.use(Vuetify)
|
|
9
|
+
|
|
10
|
+
describe('ContentClickableIcon component', () => {
|
|
11
|
+
test('is a Vue instance', () => {
|
|
12
|
+
const wrapper = shallowMount(ScenarioChoice, {
|
|
13
|
+
vuetify: new Vuetify(),
|
|
14
|
+
mocks: defaultMocks,
|
|
15
|
+
propsData: {
|
|
16
|
+
value: { body: 'scenario choice', metadata: { config: {} } },
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
expect(wrapper.vm).toBeTruthy()
|
|
20
|
+
})
|
|
21
|
+
})
|
|
@@ -11,7 +11,7 @@ describe('ClickableIconsSettings', () => {
|
|
|
11
11
|
test('is a Vue instance', () => {
|
|
12
12
|
const wrapper = shallowMount(ClickableIconsSettings, {
|
|
13
13
|
propsData: {
|
|
14
|
-
tag: 'core-clickable-
|
|
14
|
+
tag: 'core-clickable-icons-settings',
|
|
15
15
|
},
|
|
16
16
|
mocks: defaultMocks,
|
|
17
17
|
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils'
|
|
2
|
+
import Vuetify from 'vuetify'
|
|
3
|
+
import Vue from 'vue'
|
|
4
|
+
|
|
5
|
+
import { defaultMocks } from '@/test/mocks'
|
|
6
|
+
import ScenarioChoiceSettings from '@/components/Settings/ScenarioChoiceSettings'
|
|
7
|
+
|
|
8
|
+
Vue.use(Vuetify)
|
|
9
|
+
|
|
10
|
+
describe('ScenarioChoiceSettings', () => {
|
|
11
|
+
test('is a Vue instance', () => {
|
|
12
|
+
const wrapper = shallowMount(ScenarioChoiceSettings, {
|
|
13
|
+
propsData: {
|
|
14
|
+
tag: 'core-scenario-choice-settings',
|
|
15
|
+
},
|
|
16
|
+
mocks: defaultMocks,
|
|
17
|
+
})
|
|
18
|
+
expect(wrapper.vm).toBeTruthy()
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import _ from 'lodash'
|
|
2
|
+
import locales from '../../i18n'
|
|
3
|
+
import localeTest from '../locales'
|
|
4
|
+
describe('LocaleKeys', () => {
|
|
5
|
+
test('Confirm that all localizations are equal aka not missing keys between them', () => {
|
|
6
|
+
const messages = locales.messages
|
|
7
|
+
localeTest.test(messages)
|
|
8
|
+
})
|
|
9
|
+
})
|
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
jest.mock(
|
|
2
|
+
'~/components/TextIconPicker.vue',
|
|
3
|
+
() => {
|
|
4
|
+
return {
|
|
5
|
+
props: {},
|
|
6
|
+
computed: {},
|
|
7
|
+
methods: {},
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
{ virtual: true }
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
jest.mock(
|
|
14
|
+
'~/components/SortableExpansionPanel.vue',
|
|
15
|
+
() => {
|
|
16
|
+
return {
|
|
17
|
+
props: {},
|
|
18
|
+
computed: {},
|
|
19
|
+
methods: {},
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{ virtual: true }
|
|
23
|
+
)
|
|
24
|
+
|
|
1
25
|
jest.mock(
|
|
2
26
|
'~/components/Dialog.vue',
|
|
3
27
|
() => {
|
|
@@ -8,6 +8,10 @@ jest.mock('axios')
|
|
|
8
8
|
|
|
9
9
|
// Define any new model mocks here. The imports / mocks will be auto-generated below
|
|
10
10
|
const mockVirtualModels = [
|
|
11
|
+
{
|
|
12
|
+
path: '~/models/UserContentBlockState',
|
|
13
|
+
resource: 'user-content-block-state',
|
|
14
|
+
},
|
|
11
15
|
{ path: '~/models/Enrollment', resource: 'enrollments' },
|
|
12
16
|
{ path: '~/models/ContentBlock', resource: 'blocks' },
|
|
13
17
|
{ path: '~/models/FileAsset', resource: 'file-assets' },
|
package/test/locales.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import _ from 'lodash'
|
|
2
|
+
export default {
|
|
3
|
+
test(messages) {
|
|
4
|
+
// Flatten the localizations from objects to object paths
|
|
5
|
+
for (const locale of Object.keys(messages)) {
|
|
6
|
+
messages[locale] = this.flattenTree(messages[locale])
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const parsed = this.filtered(messages)
|
|
10
|
+
const missing = []
|
|
11
|
+
|
|
12
|
+
for (const message of parsed) {
|
|
13
|
+
// Check the "support" prop array. This lists all the langs that support this key
|
|
14
|
+
// This array must match the total number of locales we're checking
|
|
15
|
+
if (
|
|
16
|
+
_.get(message, 'support', []).length !==
|
|
17
|
+
Object.keys(messages).length
|
|
18
|
+
) {
|
|
19
|
+
missing.push(message)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (missing.length > 0) {
|
|
24
|
+
const errorMessages = []
|
|
25
|
+
for (const item of missing) {
|
|
26
|
+
const localesMissing = _.difference(
|
|
27
|
+
Object.keys(messages),
|
|
28
|
+
item.support
|
|
29
|
+
)
|
|
30
|
+
errorMessages.push({
|
|
31
|
+
locale_path: item.path,
|
|
32
|
+
missing_in: localesMissing,
|
|
33
|
+
found_in: item.support,
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
console.log(
|
|
37
|
+
`(${missing.length}) Localization paths are missing in other locales. See the below table:`
|
|
38
|
+
)
|
|
39
|
+
console.table(errorMessages)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
expect(missing.length).toEqual(0)
|
|
43
|
+
},
|
|
44
|
+
filtered(locales, primary = 'en-US') {
|
|
45
|
+
const results = _.cloneDeep(locales[primary])
|
|
46
|
+
|
|
47
|
+
// Loop over each locale
|
|
48
|
+
for (const [locale, messages] of Object.entries(locales)) {
|
|
49
|
+
// Now loop over all the messages aka localizations
|
|
50
|
+
for (const message of messages) {
|
|
51
|
+
// Skip plugin messages
|
|
52
|
+
if (_.startsWith(message.path, 'plugin')) {
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
const existingIndex = results.findIndex((item) => {
|
|
56
|
+
return item.path === message.path
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
if (existingIndex === -1) {
|
|
60
|
+
message.support = [locale]
|
|
61
|
+
results.push(message)
|
|
62
|
+
} else {
|
|
63
|
+
results[existingIndex].support.push(locale)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Finally filter the results
|
|
69
|
+
return results.filter((item) => {
|
|
70
|
+
return item.path.toLowerCase() || item.value.toLowerCase()
|
|
71
|
+
})
|
|
72
|
+
},
|
|
73
|
+
flattenTree(messages, path = '') {
|
|
74
|
+
let flat = []
|
|
75
|
+
|
|
76
|
+
if (_.isEmpty(messages)) {
|
|
77
|
+
messages = []
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
for (const [key, value] of Object.entries(messages)) {
|
|
81
|
+
let newPath = key
|
|
82
|
+
if (path !== '') {
|
|
83
|
+
newPath = path + '.' + key
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (typeof value === 'object') {
|
|
87
|
+
flat = flat.concat(this.flattenTree(value, newPath))
|
|
88
|
+
} else {
|
|
89
|
+
flat.push({ support: [], path: newPath, value })
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return flat
|
|
94
|
+
},
|
|
95
|
+
}
|