Skip to content

Commit c243a3d

Browse files
committed
refactor: use Typescript for l10n dummy import
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent fe39245 commit c243a3d

File tree

49 files changed

+53
-52
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+53
-52
lines changed

build/l10n-plugin.mts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
/**
1+
/*!
22
* SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

66
import type { Plugin } from 'vite'
7+
78
import { loadTranslations } from './translations.mts'
89
import { dirname, resolve } from 'path'
910

1011
/**
1112
* This is a plugin to split all translations into chunks of users meaning components that use that translation
12-
* If a file imports `t` or `n` from 'l10n.js' that import will be replaced with a wrapper that registeres only the required translations for the file that imports the functions.
13+
* If a file imports `t` or `n` from 'l10n.ts' that import will be replaced with a wrapper that registeres only the required translations for the file that imports the functions.
1314
* Allowing vite to treeshake all not needed translations when building applications
1415
*
1516
* @param dir Path to the l10n directory for loading the translations
@@ -57,7 +58,7 @@ export default (dir: string) => {
5758
},
5859

5960
/**
60-
* Hook into module resolver and fake all '../[...]/l10n.js' imports to inject our splitted translations
61+
* Hook into module resolver and fake all '../[...]/l10n.ts' imports to inject our splitted translations
6162
* @param source The file which is imported
6263
* @param importer The file that imported the file
6364
*/
@@ -69,7 +70,7 @@ export default (dir: string) => {
6970
}
7071
// dont handle other plugins imports
7172
return null
72-
} else if (source.endsWith('l10n.js') && importer && !importer.includes('node_modules')) {
73+
} else if (source.endsWith('l10n.ts') && importer && !importer.includes('node_modules')) {
7374
if (dirname(resolve(dirname(importer), source)).split('/').at(-1) === 'src') {
7475
// return our wrapper for handling the import
7576
return `\0l10nwrapper?source=${encodeURIComponent(importer)}`

src/components/NcActionButtonGroup/NcActionButtonGroup.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export default {
8888
<script>
8989
import { defineComponent } from 'vue'
9090
import { createElementId } from '../../utils/createElementId.ts'
91-
import { t } from '../../l10n.js'
91+
import { t } from '../../l10n.ts'
9292
import { NC_ACTIONS_IS_SEMANTIC_MENU } from '../NcActions/useNcActions.ts'
9393
9494
/**

src/components/NcActionInput/NcActionInput.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ import NcSelect from '../NcSelect/index.js'
248248
import NcTextField from '../NcTextField/index.ts'
249249
import ActionGlobalMixin from '../../mixins/actionGlobal.js'
250250
import { createElementId } from '../../utils/createElementId.ts'
251-
import { t } from '../../l10n.js'
251+
import { t } from '../../l10n.ts'
252252
253253
export default {
254254
name: 'NcActionInput',

src/components/NcActions/NcActions.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ import { Fragment, computed, h, mergeProps, ref, toRef, warn } from 'vue'
923923
import { useTrapStackControl } from '../../composables/useTrapStackControl.ts'
924924
import { createElementId } from '../../utils/createElementId.ts'
925925
import { isSlotPopulated } from '../../utils/isSlotPopulated.ts'
926-
import { t } from '../../l10n.js'
926+
import { t } from '../../l10n.ts'
927927
928928
import IconDotsHorizontal from 'vue-material-design-icons/DotsHorizontal.vue'
929929
import NcButton from '../NcButton/index.ts'

src/components/NcAppContent/NcAppContentDetailsToggle.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { onBeforeUnmount, watch } from 'vue'
1010
import NcButton from '../NcButton/index.ts'
1111
import NcIconSvgWrapper from '../NcIconSvgWrapper/index.ts'
1212
import { useIsMobile } from '../../composables/useIsMobile/index.js'
13-
import { t } from '../../l10n.js'
13+
import { t } from '../../l10n.ts'
1414
1515
const isMobile = useIsMobile()
1616
watch(isMobile, toggleAppNavigationButton, { immediate: true })

src/components/NcAppNavigationItem/NcAppNavigationIconCollapsible.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</template>
2121

2222
<script>
23-
import { t } from '../../l10n.js'
23+
import { t } from '../../l10n.ts'
2424
import NcButton from '../NcButton/index.ts'
2525
import ChevronDown from 'vue-material-design-icons/ChevronDown.vue'
2626
import ChevronUp from 'vue-material-design-icons/ChevronUp.vue'

src/components/NcAppNavigationItem/NcAppNavigationItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ Just set the `pinned` prop.
393393
<script>
394394
import { useIsMobile } from '../../composables/useIsMobile/index.js'
395395
import { createElementId } from '../../utils/createElementId.ts'
396-
import { t } from '../../l10n.js'
396+
import { t } from '../../l10n.ts'
397397
398398
import Pencil from 'vue-material-design-icons/Pencil.vue'
399399
import Undo from 'vue-material-design-icons/Undo.vue'

src/components/NcAppNavigationItem/NcInputConfirmCancel.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
</div>
4343
</template>
4444
<script>
45-
import { t } from '../../l10n.js'
45+
import { t } from '../../l10n.ts'
4646
4747
import IconArrowRight from 'vue-material-design-icons/ArrowRight.vue'
4848
import IconClose from 'vue-material-design-icons/Close.vue'

src/components/NcAppNavigationSearch/NcAppNavigationSearch.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export default {
153153
<script setup lang="ts">
154154
import { useFocusWithin } from '@vueuse/core'
155155
import { ref, nextTick, useSlots, watch, useTemplateRef } from 'vue'
156-
import { t } from '../../l10n.js'
156+
import { t } from '../../l10n.ts'
157157
158158
import IconClose from 'vue-material-design-icons/Close.vue'
159159
import NcInputField from '../NcInputField/NcInputField.vue'

src/components/NcAppNavigationSettings/NcAppNavigationSettings.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { Slot } from 'vue'
88
import { onClickOutside } from '@vueuse/core'
99
import { computed, ref, useTemplateRef } from 'vue'
1010
import { createElementId } from '../../utils/createElementId.js'
11-
import { t } from '../../l10n.js'
11+
import { t } from '../../l10n.ts'
1212
1313
import IconCog from 'vue-material-design-icons/Cog.vue'
1414
import NcButton from '../NcButton/NcButton.vue'

0 commit comments

Comments
 (0)