Skip to content

Commit 4043147

Browse files
Merge pull request #1087 from nextcloud-libraries/fix/deps/no-node-gettext
fix(deps): migrate away from node-gettext
2 parents 412f248 + a991d20 commit 4043147

4 files changed

Lines changed: 9 additions & 15 deletions

File tree

l10n/messages.pot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ msgid ""
22
msgstr ""
33
"Content-Type: text/plain; charset=UTF-8\n"
44

5-
#: lib/index.ts:24
5+
#: lib/index.ts:25
66
msgid "seconds"
77
msgstr ""

lib/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* SPDX-License-Identifier: GPL-3.0-or-later
44
*/
55
import moment from 'moment/min/moment-with-locales.js'
6-
import Gettext from 'node-gettext'
76
import { getLocale } from '@nextcloud/l10n'
7+
import { getGettextBuilder } from '@nextcloud/l10n/gettext'
88

99
const locale = getLocale()
1010
const translations = LOCALES
@@ -15,9 +15,10 @@ moment.locale(locale)
1515
// track in transifex, so we prefer the included translation. Always prefer our default english
1616
// translation.
1717
if (locale === 'en' || locale in translations) {
18-
const gt = new Gettext()
19-
gt.addTranslations(locale, 'messages', translations[locale])
20-
gt.setLocale(locale)
18+
const gt = getGettextBuilder()
19+
.setLanguage(locale)
20+
.addTranslation(locale, translations[locale])
21+
.build()
2122

2223
moment.updateLocale(moment.locale(), {
2324
relativeTime: {

package-lock.json

Lines changed: 2 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"dist"
4040
],
4141
"dependencies": {
42-
"@nextcloud/l10n": "^3.1.0",
42+
"@nextcloud/l10n": "^3.2.0",
4343
"moment": "^2.30.1",
4444
"node-gettext": "^3.0.0"
4545
},
@@ -48,7 +48,6 @@
4848
"@nextcloud/eslint-config": "^8.3.0",
4949
"@nextcloud/vite-config": "^2.2.2",
5050
"@types/node": "^22.7.5",
51-
"@types/node-gettext": "^3.0.6",
5251
"eslint": "^8.56.0",
5352
"gettext-extractor": "^3.8.0",
5453
"gettext-parser": "^8.0.0",

0 commit comments

Comments
 (0)