Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions translations/translationtool/src/translationtool.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2017-2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2017 Jakob Sack <[email protected]>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
Expand Down Expand Up @@ -366,8 +366,8 @@ private function createFakeFileForVueFiles(): void {
}

$matches = [];
if (preg_match('/<script[^>]*>(.+)<\/script>/s', $vueSource, $matches)) {
$fakeFileContent .= $matches[1] . ";\n";
if (preg_match_all('/<script[^>]*>(.+)<\/script>/sU', $vueSource, $matches, PREG_PATTERN_ORDER)) {
$fakeFileContent .= implode('', $matches[1]) . ";\n";
}

if (preg_match('/<template>(.+)<\/template>/s', $vueSource, $matches, PREG_OFFSET_CAPTURE)) {
Expand Down
13 changes: 13 additions & 0 deletions translations/translationtool/tests/expected.pot
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,19 @@ msgid_plural "%n tests"
msgstr[0] ""
msgstr[1] ""

#: specialVueFakeDummyForL10nScript.js:37
msgid "String in \"setup\" script section"
msgstr ""

#: specialVueFakeDummyForL10nScript.js:44
msgid "String in non-setup script section"
msgstr ""

#. TRANSLATORS src/zz-vue-setup.vue:7
#: specialVueFakeDummyForL10nScript.js:50
msgid "String in template part"
msgstr ""

#. TRANSLATORS VUE plural with parameters (src/vue.vue:19)
#: specialVueFakeDummyForL10nScript.js:31
msgid "VUE %n Plural with %s"
Expand Down
22 changes: 22 additions & 0 deletions translations/translationtool/tests/src/zz-vue-setup.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--
- SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<!-- ensure that also vue files with both, setup and non-setup script sections can be handled. -->
<template>
{{ t('test', 'String in template part') }}
</template>
<script setup>
const setupText = t('blahblah', 'String in "setup" script section')
</script>
<script>
import { translate as t } from '@nextcloud/l10n'

export default {
computed: {
text() {
return t('blahblah', 'String in non-setup script section')
}
}
}
</script>
Binary file modified translations/translationtool/translationtool.phar
Binary file not shown.