diff --git a/package.json b/package.json index 60f22f56..a9c3a28e 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "esbuild": "^0.23.0", "fs-extra": "^11.2.0", "gulp-sort": "^2.0.0", - "i18next": "^23.5.1", + "i18next": "^23.5.1 || ^24.0.0", "js-yaml": "^4.1.0", "lilconfig": "^3.1.2", "rsvp": "^4.8.5", diff --git a/test/parser.test.js b/test/parser.test.js index f056f4f8..df6e90e1 100644 --- a/test/parser.test.js +++ b/test/parser.test.js @@ -1,5 +1,6 @@ import { assert, expect } from 'chai' import { fileURLToPath } from 'url' +import { createRequire } from 'module' import fs from 'fs' import path from 'path' import sinon from 'sinon' @@ -10,6 +11,12 @@ const enLibraryPath = path.normalize('en/translation.json') const arLibraryPath = path.normalize('ar/translation.json') const __dirname = path.dirname(fileURLToPath(import.meta.url)) +function getI18NextMajorVersion() { + const require = createRequire(import.meta.url) + const pkg = require('i18next/package.json') + return pkg.version.split('.').map(Number)[0] +} + describe('parser', () => { it('parses globally on multiple lines', (done) => { let result @@ -1688,7 +1695,12 @@ describe('parser', () => { i18nextParser.end(fakeFile) }) - it('generates plurals according to compatibilityJSON value', (done) => { + it('generates plurals according to compatibilityJSON value', function (done) { + if (getI18NextMajorVersion() >= 24) { + // v24 only supports compatibilityJSON="v4" + this.skip() + } + let result const i18nextParser = new i18nTransform({ i18nextOptions: { compatibilityJSON: 'v3' }, @@ -1714,7 +1726,12 @@ describe('parser', () => { i18nextParser.end(fakeFile) }) - it('generates plurals according to compatibilityJSON value for languages with multiple plural forms', (done) => { + it('generates plurals according to compatibilityJSON value for languages with multiple plural forms', function (done) { + if (getI18NextMajorVersion() >= 24) { + // v24 only supports compatibilityJSON="v4" + this.skip() + } + let result const i18nextParser = new i18nTransform({ locales: ['ar'], diff --git a/yarn.lock b/yarn.lock index a1fba664..29f40b89 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3072,10 +3072,10 @@ husky@^9.1.4: resolved "https://registry.yarnpkg.com/husky/-/husky-9.1.4.tgz#926fd19c18d345add5eab0a42b2b6d9a80259b34" integrity sha512-bho94YyReb4JV7LYWRWxZ/xr6TtOTt8cMfmQ39MQYJ7f/YE268s3GdghGwi+y4zAeqewE5zYLvuhV0M0ijsDEA== -i18next@^23.5.1: - version "23.11.5" - resolved "https://registry.yarnpkg.com/i18next/-/i18next-23.11.5.tgz#d71eb717a7e65498d87d0594f2664237f9e361ef" - integrity sha512-41pvpVbW9rhZPk5xjCX2TPJi2861LEig/YRhUkY+1FQ2IQPS0bKUDYnEqY8XPPbB48h1uIwLnP9iiEfuSl20CA== +"i18next@^23.5.1 || ^24.0.0": + version "24.0.5" + resolved "https://registry.yarnpkg.com/i18next/-/i18next-24.0.5.tgz#2678986eca46411cae0329542a84dd4cd7e5f2f0" + integrity sha512-1jSdEzgFPGLZRsQwydoMFCBBaV+PmrVEO5WhANllZPX4y2JSGTxUjJ+xVklHIsiS95uR8gYc/y0hYZWevucNjg== dependencies: "@babel/runtime" "^7.23.2"