-
+
{{ $t('trans.login.authenticateWith') }}
@@ -43,7 +43,7 @@ const { loginButtons } = storeToRefs(idpStore);
-
+
{{ $t('trans.login.alreadyLoggedIn') }}
@@ -51,11 +51,11 @@ const { loginButtons } = storeToRefs(idpStore);
class="ma-2"
color="primary"
size="large"
- :lang="lang"
+ :lang="locale"
:title="$t('trans.login.about')"
>
- {{ $t('trans.login.about') }}
+ {{ $t('trans.login.about') }}
diff --git a/app/frontend/src/views/NotFound.vue b/app/frontend/src/views/NotFound.vue
index 71859ae6b..27657d13c 100755
--- a/app/frontend/src/views/NotFound.vue
+++ b/app/frontend/src/views/NotFound.vue
@@ -1,18 +1,16 @@
- {{ $t('trans.notFound.pageNotFound') }}
+ {{ $t('trans.notFound.pageNotFound') }}
- {{ $t('trans.notFound.about') }}
+ {{ $t('trans.notFound.about') }}
diff --git a/app/frontend/src/views/admin/Form.vue b/app/frontend/src/views/admin/Form.vue
index b9c60248d..4fc5bf101 100644
--- a/app/frontend/src/views/admin/Form.vue
+++ b/app/frontend/src/views/admin/Form.vue
@@ -1,8 +1,12 @@
-
+
{{ $t('trans.admin.form.administerForm') }}
diff --git a/app/frontend/src/views/admin/Root.vue b/app/frontend/src/views/admin/Root.vue
index c5f722812..1430d5c64 100644
--- a/app/frontend/src/views/admin/Root.vue
+++ b/app/frontend/src/views/admin/Root.vue
@@ -1,14 +1,18 @@
-
+
{{ $t('trans.admin.root.admin') }}
diff --git a/app/frontend/src/views/admin/User.vue b/app/frontend/src/views/admin/User.vue
index 39fbe9401..a48f2c16b 100644
--- a/app/frontend/src/views/admin/User.vue
+++ b/app/frontend/src/views/admin/User.vue
@@ -1,8 +1,12 @@
-
+
{{ $t('trans.admin.user.administerUser') }}
diff --git a/app/frontend/src/views/file/Download.vue b/app/frontend/src/views/file/Download.vue
index 8a710a1a3..f12664346 100644
--- a/app/frontend/src/views/file/Download.vue
+++ b/app/frontend/src/views/file/Download.vue
@@ -1,11 +1,14 @@
@@ -31,7 +35,7 @@ const APP_PERMS = computed(() => AppPermissions);
{{ $t('trans.preview.preview') }}
@@ -44,7 +48,7 @@ const APP_PERMS = computed(() => AppPermissions);
icon="mdi:mdi-help-circle-outline"
/>
-
+
{{ $t('trans.preview.previewToolTip') }}
diff --git a/app/frontend/src/views/form/PublishForm.vue b/app/frontend/src/views/form/PublishForm.vue
index c6448bd9c..12444f485 100644
--- a/app/frontend/src/views/form/PublishForm.vue
+++ b/app/frontend/src/views/form/PublishForm.vue
@@ -1,12 +1,15 @@
@@ -22,7 +25,7 @@ const { form, isRTL, lang } = storeToRefs(useFormStore());
-
+
-
+
{{ $t('trans.sucess.keepRecord') }}{{ ' ' }}
-
+
{{ $t('trans.sucess.confirmationId') }}:
{{ s.substring(0, 8).toUpperCase() }}
diff --git a/app/frontend/src/views/user/History.vue b/app/frontend/src/views/user/History.vue
index f1a91d680..e541b288a 100644
--- a/app/frontend/src/views/user/History.vue
+++ b/app/frontend/src/views/user/History.vue
@@ -1,13 +1,12 @@
-
+
{{ $t('trans.history.submissnHistory') }}
diff --git a/app/frontend/src/views/user/Root.vue b/app/frontend/src/views/user/Root.vue
index 03dc04ad5..a52b512ef 100644
--- a/app/frontend/src/views/user/Root.vue
+++ b/app/frontend/src/views/user/Root.vue
@@ -1,8 +1,7 @@
@@ -14,7 +13,8 @@ const { lang } = storeToRefs(useFormStore());
data-test="my-forms-btn"
:title="$t('trans.user.root.myForms')"
>
- {{ $t('trans.user.root.myForms') }}
+ {{ $t('trans.user.root.myForms') }}
+ {{ $t('trans.user.root.myForms') }}
@@ -24,10 +24,10 @@ const { lang } = storeToRefs(useFormStore());
data-test="history-btn"
:title="$t('trans.user.root.history')"
>
- {{ $t('trans.user.root.history') }}
+ {{ $t('trans.user.root.history') }}
-
+
{{ $t('trans.user.root.user') }}
diff --git a/app/frontend/tests/unit/components/base/BaseInternationalization.spec.js b/app/frontend/tests/unit/components/base/BaseInternationalization.spec.js
index e9439da0e..378fe02fd 100644
--- a/app/frontend/tests/unit/components/base/BaseInternationalization.spec.js
+++ b/app/frontend/tests/unit/components/base/BaseInternationalization.spec.js
@@ -8,84 +8,48 @@ import { useFormStore } from '~/store/form';
describe('BaseInternationalization.vue', () => {
const pinia = createPinia();
setActivePinia(pinia);
- const formStore = useFormStore();
+ const formStore = useFormStore(pinia);
beforeEach(() => {
- formStore.lang = 'en';
+ formStore.$reset();
+
+ formStore.isRTL = false;
});
it('renders', async () => {
const wrapper = mount(BaseInternationalization, {
global: {
- stubs: {
- VDialog: {
- name: 'VMenu',
- template: '',
- },
- },
+ plugins: [pinia],
},
});
await flushPromises();
// Default language
- expect(wrapper.text()).toContain('English');
+ expect(wrapper.html()).toContain('v-select');
});
- it('changes language', async () => {
+ it('changes language should update the form stores isRTL', async () => {
const wrapper = mount(BaseInternationalization, {
global: {
- stubs: {
- VDialog: {
- name: 'VMenu',
- template: '',
- },
- },
+ plugins: [pinia],
},
});
await flushPromises();
- // Default language
- expect(wrapper.text()).toContain('English');
-
- expect(formStore.lang).toBe('en');
-
- wrapper.vm.languageSelected({
- title: '简体中文 (Simplified Chinese)',
- keyword: 'zh',
- });
-
- expect(formStore.lang).toBe('zh');
-
- wrapper.vm.languageSelected({
- title: '繁體中文 (Traditional Chinese)',
- keyword: 'zhTW',
- });
+ wrapper.vm.languageSelected('zh');
- expect(formStore.lang).toBe('zhTW');
+ expect(formStore.isRTL).toBeFalsy();
- wrapper.vm.languageSelected({
- title: '繁體中文 (Traditional Chinese)',
- keyword: 'zhTW',
- });
+ wrapper.vm.languageSelected('zhTW');
- expect(formStore.lang).toBe('zhTW');
+ wrapper.vm.languageSelected('zhTW');
- wrapper.vm.languageSelected({
- title: 'UNKNOWN',
- keyword: 'zhCUSTOM',
- });
+ wrapper.vm.languageSelected('zhCUSTOM');
- expect(formStore.lang).toBe('zhCUSTOM');
- expect(formStore.isRTL).toBeFalsy();
-
- wrapper.vm.languageSelected({
- title: 'عربى (Arabic)',
- keyword: 'ar',
- });
+ wrapper.vm.languageSelected('ar');
- expect(formStore.lang).toBe('ar');
expect(formStore.isRTL).toBeTruthy();
});
});
diff --git a/app/frontend/tests/unit/components/designer/profile/FormUseCaseProfile.spec.js b/app/frontend/tests/unit/components/designer/profile/FormUseCaseProfile.spec.js
index 208206f0c..7faa37120 100644
--- a/app/frontend/tests/unit/components/designer/profile/FormUseCaseProfile.spec.js
+++ b/app/frontend/tests/unit/components/designer/profile/FormUseCaseProfile.spec.js
@@ -1,9 +1,10 @@
import FormUseCaseProfile from '~/components/designer/profile/FormUseCaseProfile.vue';
import { useFormStore } from '~/store/form';
+import { FormProfileValues } from '~/utils/constants';
+
import { createTestingPinia } from '@pinia/testing';
import { setActivePinia } from 'pinia';
import { mount } from '@vue/test-utils';
-import { FormProfileValues } from '~/utils/constants';
describe('FormUseCaseProfile.vue', () => {
const pinia = createTestingPinia();
@@ -35,6 +36,7 @@ describe('FormUseCaseProfile.vue', () => {
const select = wrapper.findComponent('[data-test="case-select"]');
const items = select.componentVM.items;
+ console.log(items);
expect(items).toEqual(FormProfileValues.USE_CASE);
});
});
diff --git a/app/frontend/tests/unit/components/designer/settings/FormFunctionalitySettings.spec.js b/app/frontend/tests/unit/components/designer/settings/FormFunctionalitySettings.spec.js
index 3efafb4d5..4981b3489 100644
--- a/app/frontend/tests/unit/components/designer/settings/FormFunctionalitySettings.spec.js
+++ b/app/frontend/tests/unit/components/designer/settings/FormFunctionalitySettings.spec.js
@@ -1,5 +1,5 @@
import { createTestingPinia } from '@pinia/testing';
-import { flushPromises, mount } from '@vue/test-utils';
+import { mount } from '@vue/test-utils';
import { setActivePinia } from 'pinia';
import { beforeEach, describe, expect, it } from 'vitest';
import { ref } from 'vue';
diff --git a/app/frontend/tests/unit/i18n.config.js b/app/frontend/tests/unit/i18n.config.js
index 52e572e42..56f0c1f92 100644
--- a/app/frontend/tests/unit/i18n.config.js
+++ b/app/frontend/tests/unit/i18n.config.js
@@ -4,6 +4,26 @@ import { ref } from 'vue';
const i18n = vi.fn(() => {});
const translate = vi.fn(() => {});
+const locales = [
+ 'ar',
+ 'de',
+ 'en',
+ 'es',
+ 'fa',
+ 'fr',
+ 'hi',
+ 'it',
+ 'ja',
+ 'ko',
+ 'pa',
+ 'pt',
+ 'ru',
+ 'tl',
+ 'uk',
+ 'vi',
+ 'zh',
+ 'zhTW',
+];
translate.mockImplementation((key, options = {}) => {
return {
@@ -14,7 +34,7 @@ translate.mockImplementation((key, options = {}) => {
i18n.mockImplementation(() => {
return {
- locale: 'en',
+ locale: ref('en'),
t: translate,
};
});
@@ -26,6 +46,7 @@ vi.mock('vue-i18n', () => {
global: {
t: (key, _options = {}) => key,
},
+ locale: ref('en'),
};
},
useI18n: () => ({
@@ -38,8 +59,9 @@ vi.mock('vue-i18n', () => {
config.global.mocks = {
$i18n: () => ({
locale: 'en',
+ availableLocales: locales,
}),
- $t: (tKey) => tKey,
+ $t: (key, _options = {}) => key,
};
beforeEach(() => {
diff --git a/app/frontend/tests/unit/views/Error.spec.js b/app/frontend/tests/unit/views/Error.spec.js
index 80a790289..35fbee5e6 100644
--- a/app/frontend/tests/unit/views/Error.spec.js
+++ b/app/frontend/tests/unit/views/Error.spec.js
@@ -3,8 +3,8 @@ import { mount } from '@vue/test-utils';
import { setActivePinia } from 'pinia';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { nextTick } from 'vue';
+import { useI18n } from 'vue-i18n';
-import { i18n } from '~/internationalization';
import { useAuthStore } from '~/store/auth';
import Error from '~/views/Error.vue';
@@ -34,7 +34,6 @@ describe('Error.vue', () => {
});
it('renders with a custom error message', async () => {
- const translateSpy = vi.spyOn(i18n, 't');
const wrapper = mount(Error, {
props: {
text: 'Custom Error Message',
@@ -50,11 +49,9 @@ describe('Error.vue', () => {
await nextTick();
expect(wrapper.text()).toMatch('Custom Error Message');
- expect(translateSpy).toHaveBeenCalledTimes(1);
});
it('renders with a custom error message without translating', async () => {
- const translateSpy = vi.spyOn(i18n, 't');
const wrapper = mount(Error, {
props: {
text: 'Custom Error Message',
@@ -72,6 +69,5 @@ describe('Error.vue', () => {
// Should fail to parse the json and translate is not passed
expect(wrapper.text()).toMatch('Custom Error Message');
- expect(translateSpy).toHaveBeenCalledTimes(0);
});
});
diff --git a/app/frontend/tests/unit/views/form/Design.spec.js b/app/frontend/tests/unit/views/form/Design.spec.js
index 60a8ee1fa..74365ff19 100644
--- a/app/frontend/tests/unit/views/form/Design.spec.js
+++ b/app/frontend/tests/unit/views/form/Design.spec.js
@@ -36,6 +36,10 @@ describe('Design.vue', () => {
global: {
plugins: [pinia],
stubs: {
+ BaseSecure: {
+ name: 'BaseSecure',
+ template: '
',
+ },
FormDesigner: {
name: 'FormDesigner',
methods: {