adminforth 1.5.8-next.10 → 1.5.8-next.11

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.
@@ -1,5 +1,7 @@
1
1
  <template>
2
2
  <div class="rounded-default">
3
+ <pre>
4
+ </pre>
3
5
  <form autocomplete="off" @submit.prevent>
4
6
  <div v-if="!groups || groups.length === 0">
5
7
  <GroupsTable
@@ -64,9 +66,10 @@ import { computed, onMounted, ref, watch } from 'vue';
64
66
  import { useRouter, useRoute } from 'vue-router';
65
67
  import { useCoreStore } from "@/stores/core";
66
68
  import GroupsTable from '@/components/GroupsTable.vue';
69
+ import { useI18n } from 'vue-i18n';
67
70
 
68
- const coreStore = useCoreStore();
69
71
 
72
+ const coreStore = useCoreStore();
70
73
  const router = useRouter();
71
74
  const route = useRoute();
72
75
  const props = defineProps({
@@ -78,7 +81,7 @@ const props = defineProps({
78
81
 
79
82
  const unmasked = ref({});
80
83
 
81
- const mode = computed(() => route.name === 'resource-create' ? $t('create') : $t('edit'));
84
+ const mode = computed(() => route.name === 'resource-create' ? 'create' : 'edit');
82
85
 
83
86
  const emit = defineEmits(['update:record', 'update:isValid']);
84
87
 
@@ -2,6 +2,26 @@ import { createI18n } from 'vue-i18n';
2
2
  import { createApp } from 'vue';
3
3
 
4
4
 
5
+ // taken from here https://vue-i18n.intlify.dev/guide/essentials/pluralization.html#custom-pluralization
6
+ function slavicPluralRule(choice, choicesLength, orgRule) {
7
+ if (choice === 0) {
8
+ return 0
9
+ }
10
+
11
+ const teen = choice > 10 && choice < 20
12
+ const endsWithOne = choice % 10 === 1
13
+
14
+ if (!teen && endsWithOne) {
15
+ return 1
16
+ }
17
+ if (!teen && choice % 10 >= 2 && choice % 10 <= 4) {
18
+ return 2
19
+ }
20
+
21
+ return choicesLength < 4 ? 2 : 3
22
+ }
23
+
24
+
5
25
  export function initI18n(app: ReturnType<typeof createApp>) {
6
26
  const i18n = createI18n({
7
27
  legacy: false,
@@ -9,6 +29,20 @@ export function initI18n(app: ReturnType<typeof createApp>) {
9
29
  missingWarn: false,
10
30
  fallbackWarn: false,
11
31
 
32
+ pluralRules: {
33
+ 'uk': slavicPluralRule,
34
+ 'bg': slavicPluralRule,
35
+ 'cs': slavicPluralRule,
36
+ 'hr': slavicPluralRule,
37
+ 'mk': slavicPluralRule,
38
+ 'pl': slavicPluralRule,
39
+ 'sk': slavicPluralRule,
40
+ 'sl': slavicPluralRule,
41
+ 'sr': slavicPluralRule,
42
+ 'be': slavicPluralRule,
43
+ 'ru': slavicPluralRule,
44
+ },
45
+
12
46
  missing: (locale, key) => {
13
47
  // very very dirty hack to make work $t("a {key} b", { key: "c" }) as "a c b" when translation is missing
14
48
  // e.g. relevant for "Showing {from} to {to} of {total} entries" on list page
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.5.8-next.10",
3
+ "version": "1.5.8-next.11",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",