gt-next 4.2.2 → 4.2.4-beta
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.
- package/dist/_dictionary.d.ts.map +1 -0
- package/dist/_dictionary.js.map +1 -0
- package/dist/{types/_request.d.ts.map → _request.d.ts.map} +1 -1
- package/dist/{esm/_request.js.map → _request.js.map} +1 -1
- package/dist/branches/Branch.d.ts.map +1 -0
- package/dist/branches/Branch.js.map +1 -0
- package/dist/branches/Plural.d.ts.map +1 -0
- package/dist/branches/Plural.js.map +1 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js.map +1 -0
- package/dist/config/I18NConfiguration.d.ts.map +1 -0
- package/dist/config/I18NConfiguration.js.map +1 -0
- package/dist/config/RemoteTranslationsManager.d.ts.map +1 -0
- package/dist/config/RemoteTranslationsManager.js.map +1 -0
- package/dist/config/getI18NConfig.d.ts.map +1 -0
- package/dist/config/getI18NConfig.js.map +1 -0
- package/dist/config/props/InitGTProps.d.ts.map +1 -0
- package/dist/config/props/InitGTProps.js.map +1 -0
- package/dist/config/props/defaultInitGTProps.d.ts.map +1 -0
- package/dist/config/props/defaultInitGTProps.js.map +1 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js.map +1 -0
- package/dist/dictionary/getDictionary.d.ts +3 -0
- package/dist/dictionary/getDictionary.d.ts.map +1 -0
- package/dist/dictionary/getDictionary.js.map +1 -0
- package/dist/errors/createErrors.d.ts.map +1 -0
- package/dist/errors/createErrors.js.map +1 -0
- package/dist/index.client.d.ts.map +1 -0
- package/dist/index.client.js.map +1 -0
- package/dist/index.server.d.ts.map +1 -0
- package/dist/index.server.js.map +1 -0
- package/dist/middleware/createNextMiddleware.d.ts.map +1 -0
- package/dist/middleware/createNextMiddleware.js.map +1 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/middleware.js.map +1 -0
- package/dist/next/getNextDomain.d.ts.map +1 -0
- package/dist/next/getNextDomain.js.map +1 -0
- package/dist/next/getNextLocale.d.ts.map +1 -0
- package/dist/next/getNextLocale.js.map +1 -0
- package/dist/provider/ClientProvider.d.ts.map +1 -0
- package/dist/provider/ClientProvider.js.map +1 -0
- package/dist/provider/GTProvider.d.ts.map +1 -0
- package/dist/provider/GTProvider.js.map +1 -0
- package/dist/request/getLocale.d.ts.map +1 -0
- package/dist/request/getLocale.js.map +1 -0
- package/dist/request/getMetadata.d.ts.map +1 -0
- package/dist/request/getMetadata.js.map +1 -0
- package/dist/{types/server → server}/getGT.d.ts +1 -1
- package/dist/server/getGT.d.ts.map +1 -0
- package/dist/{cjs/server → server}/getGT.js +22 -18
- package/dist/server/getGT.js.map +1 -0
- package/dist/server/inline/Resolver.d.ts.map +1 -0
- package/dist/server/inline/Resolver.js.map +1 -0
- package/dist/server/inline/T.d.ts.map +1 -0
- package/dist/server/inline/T.js.map +1 -0
- package/dist/server/rendering/renderVariable.d.ts.map +1 -0
- package/dist/server/rendering/renderVariable.js.map +1 -0
- package/dist/server/strings/tx.d.ts.map +1 -0
- package/dist/{cjs/server → server}/strings/tx.js +1 -2
- package/dist/server/strings/tx.js.map +1 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js.map +1 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/{esm/types → types}/types.js.map +1 -1
- package/dist/utils/checkTypes.d.ts.map +1 -0
- package/dist/utils/checkTypes.js.map +1 -0
- package/dist/utils/getDefaultFromEnv.d.ts.map +1 -0
- package/dist/utils/getDefaultFromEnv.js.map +1 -0
- package/dist/utils/getGTProp.d.ts.map +1 -0
- package/dist/utils/getGTProp.js.map +1 -0
- package/dist/variables/Currency.d.ts.map +1 -0
- package/dist/variables/Currency.js.map +1 -0
- package/dist/variables/DateTime.d.ts.map +1 -0
- package/dist/variables/DateTime.js.map +1 -0
- package/dist/variables/Num.d.ts.map +1 -0
- package/dist/variables/Num.js.map +1 -0
- package/dist/variables/Var.d.ts.map +1 -0
- package/dist/variables/Var.js.map +1 -0
- package/package.json +11 -21
- package/tsconfig.json +1 -1
- package/dist/cjs/_dictionary.js.map +0 -1
- package/dist/cjs/_request.js.map +0 -1
- package/dist/cjs/branches/Branch.js.map +0 -1
- package/dist/cjs/branches/Plural.js.map +0 -1
- package/dist/cjs/client.js.map +0 -1
- package/dist/cjs/config/I18NConfiguration.js.map +0 -1
- package/dist/cjs/config/RemoteTranslationsManager.js.map +0 -1
- package/dist/cjs/config/getI18NConfig.js.map +0 -1
- package/dist/cjs/config/props/InitGTProps.js.map +0 -1
- package/dist/cjs/config/props/defaultInitGTProps.js.map +0 -1
- package/dist/cjs/config.js.map +0 -1
- package/dist/cjs/dictionary/getDictionary.js.map +0 -1
- package/dist/cjs/errors/createErrors.js.map +0 -1
- package/dist/cjs/index.client.js.map +0 -1
- package/dist/cjs/index.server.js.map +0 -1
- package/dist/cjs/middleware/createNextMiddleware.js.map +0 -1
- package/dist/cjs/middleware.js.map +0 -1
- package/dist/cjs/next/getNextDomain.js.map +0 -1
- package/dist/cjs/next/getNextLocale.js.map +0 -1
- package/dist/cjs/provider/ClientProvider.js.map +0 -1
- package/dist/cjs/provider/GTProvider.js.map +0 -1
- package/dist/cjs/request/getLocale.js.map +0 -1
- package/dist/cjs/request/getMetadata.js.map +0 -1
- package/dist/cjs/server/getGT.js.map +0 -1
- package/dist/cjs/server/inline/Resolver.js.map +0 -1
- package/dist/cjs/server/inline/T.js.map +0 -1
- package/dist/cjs/server/rendering/renderVariable.js.map +0 -1
- package/dist/cjs/server/strings/tx.js.map +0 -1
- package/dist/cjs/server.js.map +0 -1
- package/dist/cjs/types/types.js.map +0 -1
- package/dist/cjs/utils/checkTypes.js.map +0 -1
- package/dist/cjs/utils/getDefaultFromEnv.js.map +0 -1
- package/dist/cjs/utils/getGTProp.js.map +0 -1
- package/dist/cjs/variables/Currency.js.map +0 -1
- package/dist/cjs/variables/DateTime.js.map +0 -1
- package/dist/cjs/variables/Num.js.map +0 -1
- package/dist/cjs/variables/Var.js.map +0 -1
- package/dist/esm/_dictionary.js +0 -4
- package/dist/esm/_dictionary.js.map +0 -1
- package/dist/esm/_request.js +0 -6
- package/dist/esm/branches/Branch.js +0 -45
- package/dist/esm/branches/Branch.js.map +0 -1
- package/dist/esm/branches/Plural.js +0 -45
- package/dist/esm/branches/Plural.js.map +0 -1
- package/dist/esm/client.js +0 -4
- package/dist/esm/client.js.map +0 -1
- package/dist/esm/config/I18NConfiguration.js +0 -379
- package/dist/esm/config/I18NConfiguration.js.map +0 -1
- package/dist/esm/config/RemoteTranslationsManager.js +0 -200
- package/dist/esm/config/RemoteTranslationsManager.js.map +0 -1
- package/dist/esm/config/getI18NConfig.js +0 -48
- package/dist/esm/config/getI18NConfig.js.map +0 -1
- package/dist/esm/config/props/InitGTProps.js +0 -2
- package/dist/esm/config/props/InitGTProps.js.map +0 -1
- package/dist/esm/config/props/defaultInitGTProps.js +0 -62
- package/dist/esm/config/props/defaultInitGTProps.js.map +0 -1
- package/dist/esm/config.js +0 -196
- package/dist/esm/config.js.map +0 -1
- package/dist/esm/dictionary/getDictionary.js +0 -18
- package/dist/esm/dictionary/getDictionary.js.map +0 -1
- package/dist/esm/errors/createErrors.js +0 -22
- package/dist/esm/errors/createErrors.js.map +0 -1
- package/dist/esm/index.client.js +0 -8
- package/dist/esm/index.client.js.map +0 -1
- package/dist/esm/index.server.js +0 -11
- package/dist/esm/index.server.js.map +0 -1
- package/dist/esm/middleware/createNextMiddleware.js +0 -127
- package/dist/esm/middleware/createNextMiddleware.js.map +0 -1
- package/dist/esm/middleware.js +0 -3
- package/dist/esm/middleware.js.map +0 -1
- package/dist/esm/next/getNextDomain.js +0 -60
- package/dist/esm/next/getNextDomain.js.map +0 -1
- package/dist/esm/next/getNextLocale.js +0 -86
- package/dist/esm/next/getNextLocale.js.map +0 -1
- package/dist/esm/provider/ClientProvider.js +0 -222
- package/dist/esm/provider/ClientProvider.js.map +0 -1
- package/dist/esm/provider/GTProvider.js +0 -226
- package/dist/esm/provider/GTProvider.js.map +0 -1
- package/dist/esm/request/getLocale.js +0 -87
- package/dist/esm/request/getLocale.js.map +0 -1
- package/dist/esm/request/getMetadata.js +0 -83
- package/dist/esm/request/getMetadata.js.map +0 -1
- package/dist/esm/server/getGT.js +0 -207
- package/dist/esm/server/getGT.js.map +0 -1
- package/dist/esm/server/inline/Resolver.js +0 -48
- package/dist/esm/server/inline/Resolver.js.map +0 -1
- package/dist/esm/server/inline/T.js +0 -221
- package/dist/esm/server/inline/T.js.map +0 -1
- package/dist/esm/server/rendering/renderVariable.js +0 -19
- package/dist/esm/server/rendering/renderVariable.js.map +0 -1
- package/dist/esm/server/strings/tx.js +0 -156
- package/dist/esm/server/strings/tx.js.map +0 -1
- package/dist/esm/server.js +0 -10
- package/dist/esm/server.js.map +0 -1
- package/dist/esm/types/types.js +0 -34
- package/dist/esm/utils/checkTypes.js +0 -13
- package/dist/esm/utils/checkTypes.js.map +0 -1
- package/dist/esm/utils/getDefaultFromEnv.js +0 -18
- package/dist/esm/utils/getDefaultFromEnv.js.map +0 -1
- package/dist/esm/utils/getGTProp.js +0 -8
- package/dist/esm/utils/getGTProp.js.map +0 -1
- package/dist/esm/variables/Currency.js +0 -61
- package/dist/esm/variables/Currency.js.map +0 -1
- package/dist/esm/variables/DateTime.js +0 -74
- package/dist/esm/variables/DateTime.js.map +0 -1
- package/dist/esm/variables/Num.js +0 -50
- package/dist/esm/variables/Num.js.map +0 -1
- package/dist/esm/variables/Var.js +0 -41
- package/dist/esm/variables/Var.js.map +0 -1
- package/dist/types/_dictionary.d.ts.map +0 -1
- package/dist/types/branches/Branch.d.ts.map +0 -1
- package/dist/types/branches/Plural.d.ts.map +0 -1
- package/dist/types/client.d.ts.map +0 -1
- package/dist/types/config/I18NConfiguration.d.ts.map +0 -1
- package/dist/types/config/RemoteTranslationsManager.d.ts.map +0 -1
- package/dist/types/config/getI18NConfig.d.ts.map +0 -1
- package/dist/types/config/props/InitGTProps.d.ts.map +0 -1
- package/dist/types/config/props/defaultInitGTProps.d.ts.map +0 -1
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/dictionary/getDictionary.d.ts +0 -3
- package/dist/types/dictionary/getDictionary.d.ts.map +0 -1
- package/dist/types/errors/createErrors.d.ts.map +0 -1
- package/dist/types/index.client.d.ts.map +0 -1
- package/dist/types/index.server.d.ts.map +0 -1
- package/dist/types/middleware/createNextMiddleware.d.ts.map +0 -1
- package/dist/types/middleware.d.ts.map +0 -1
- package/dist/types/next/getNextDomain.d.ts.map +0 -1
- package/dist/types/next/getNextLocale.d.ts.map +0 -1
- package/dist/types/provider/ClientProvider.d.ts.map +0 -1
- package/dist/types/provider/GTProvider.d.ts.map +0 -1
- package/dist/types/request/getLocale.d.ts.map +0 -1
- package/dist/types/request/getMetadata.d.ts.map +0 -1
- package/dist/types/server/getGT.d.ts.map +0 -1
- package/dist/types/server/inline/Resolver.d.ts.map +0 -1
- package/dist/types/server/inline/T.d.ts.map +0 -1
- package/dist/types/server/rendering/renderVariable.d.ts.map +0 -1
- package/dist/types/server/strings/tx.d.ts.map +0 -1
- package/dist/types/server.d.ts.map +0 -1
- package/dist/types/types/types.d.ts.map +0 -1
- package/dist/types/utils/checkTypes.d.ts.map +0 -1
- package/dist/types/utils/getDefaultFromEnv.d.ts.map +0 -1
- package/dist/types/utils/getGTProp.d.ts.map +0 -1
- package/dist/types/variables/Currency.d.ts.map +0 -1
- package/dist/types/variables/DateTime.d.ts.map +0 -1
- package/dist/types/variables/Num.d.ts.map +0 -1
- package/dist/types/variables/Var.d.ts.map +0 -1
- package/tsconfig.base.json +0 -20
- package/tsconfig.cjs.json +0 -7
- package/tsconfig.esm.json +0 -7
- /package/dist/{types/_dictionary.d.ts → _dictionary.d.ts} +0 -0
- /package/dist/{cjs/_dictionary.js → _dictionary.js} +0 -0
- /package/dist/{types/_request.d.ts → _request.d.ts} +0 -0
- /package/dist/{cjs/_request.js → _request.js} +0 -0
- /package/dist/{types/branches → branches}/Branch.d.ts +0 -0
- /package/dist/{cjs/branches → branches}/Branch.js +0 -0
- /package/dist/{types/branches → branches}/Plural.d.ts +0 -0
- /package/dist/{cjs/branches → branches}/Plural.js +0 -0
- /package/dist/{types/client.d.ts → client.d.ts} +0 -0
- /package/dist/{cjs/client.js → client.js} +0 -0
- /package/dist/{types/config → config}/I18NConfiguration.d.ts +0 -0
- /package/dist/{cjs/config → config}/I18NConfiguration.js +0 -0
- /package/dist/{types/config → config}/RemoteTranslationsManager.d.ts +0 -0
- /package/dist/{cjs/config → config}/RemoteTranslationsManager.js +0 -0
- /package/dist/{types/config → config}/getI18NConfig.d.ts +0 -0
- /package/dist/{cjs/config → config}/getI18NConfig.js +0 -0
- /package/dist/{types/config → config}/props/InitGTProps.d.ts +0 -0
- /package/dist/{cjs/config → config}/props/InitGTProps.js +0 -0
- /package/dist/{types/config → config}/props/defaultInitGTProps.d.ts +0 -0
- /package/dist/{cjs/config → config}/props/defaultInitGTProps.js +0 -0
- /package/dist/{types/config.d.ts → config.d.ts} +0 -0
- /package/dist/{cjs/config.js → config.js} +0 -0
- /package/dist/{cjs/dictionary → dictionary}/getDictionary.js +0 -0
- /package/dist/{types/errors → errors}/createErrors.d.ts +0 -0
- /package/dist/{cjs/errors → errors}/createErrors.js +0 -0
- /package/dist/{types/index.client.d.ts → index.client.d.ts} +0 -0
- /package/dist/{cjs/index.client.js → index.client.js} +0 -0
- /package/dist/{types/index.server.d.ts → index.server.d.ts} +0 -0
- /package/dist/{cjs/index.server.js → index.server.js} +0 -0
- /package/dist/{types/middleware → middleware}/createNextMiddleware.d.ts +0 -0
- /package/dist/{cjs/middleware → middleware}/createNextMiddleware.js +0 -0
- /package/dist/{types/middleware.d.ts → middleware.d.ts} +0 -0
- /package/dist/{cjs/middleware.js → middleware.js} +0 -0
- /package/dist/{types/next → next}/getNextDomain.d.ts +0 -0
- /package/dist/{cjs/next → next}/getNextDomain.js +0 -0
- /package/dist/{types/next → next}/getNextLocale.d.ts +0 -0
- /package/dist/{cjs/next → next}/getNextLocale.js +0 -0
- /package/dist/{types/provider → provider}/ClientProvider.d.ts +0 -0
- /package/dist/{cjs/provider → provider}/ClientProvider.js +0 -0
- /package/dist/{types/provider → provider}/GTProvider.d.ts +0 -0
- /package/dist/{cjs/provider → provider}/GTProvider.js +0 -0
- /package/dist/{types/request → request}/getLocale.d.ts +0 -0
- /package/dist/{cjs/request → request}/getLocale.js +0 -0
- /package/dist/{types/request → request}/getMetadata.d.ts +0 -0
- /package/dist/{cjs/request → request}/getMetadata.js +0 -0
- /package/dist/{types/server → server}/inline/Resolver.d.ts +0 -0
- /package/dist/{cjs/server → server}/inline/Resolver.js +0 -0
- /package/dist/{types/server → server}/inline/T.d.ts +0 -0
- /package/dist/{cjs/server → server}/inline/T.js +0 -0
- /package/dist/{types/server → server}/rendering/renderVariable.d.ts +0 -0
- /package/dist/{cjs/server → server}/rendering/renderVariable.js +0 -0
- /package/dist/{types/server → server}/strings/tx.d.ts +0 -0
- /package/dist/{types/server.d.ts → server.d.ts} +0 -0
- /package/dist/{cjs/server.js → server.js} +0 -0
- /package/dist/types/{types/types.d.ts → types.d.ts} +0 -0
- /package/dist/{cjs/types → types}/types.js +0 -0
- /package/dist/{types/utils → utils}/checkTypes.d.ts +0 -0
- /package/dist/{cjs/utils → utils}/checkTypes.js +0 -0
- /package/dist/{types/utils → utils}/getDefaultFromEnv.d.ts +0 -0
- /package/dist/{cjs/utils → utils}/getDefaultFromEnv.js +0 -0
- /package/dist/{types/utils → utils}/getGTProp.d.ts +0 -0
- /package/dist/{cjs/utils → utils}/getGTProp.js +0 -0
- /package/dist/{types/variables → variables}/Currency.d.ts +0 -0
- /package/dist/{cjs/variables → variables}/Currency.js +0 -0
- /package/dist/{types/variables → variables}/DateTime.d.ts +0 -0
- /package/dist/{cjs/variables → variables}/DateTime.js +0 -0
- /package/dist/{types/variables → variables}/Num.d.ts +0 -0
- /package/dist/{cjs/variables → variables}/Num.js +0 -0
- /package/dist/{types/variables → variables}/Var.d.ts +0 -0
- /package/dist/{cjs/variables → variables}/Var.js +0 -0
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import { headers } from 'next/headers';
|
|
38
|
-
import { cookies } from 'next/headers';
|
|
39
|
-
import { determineLocale } from 'generaltranslation';
|
|
40
|
-
import { localeCookieName, localeHeaderName } from 'generaltranslation/internal';
|
|
41
|
-
/**
|
|
42
|
-
* Retrieves the 'accept-language' header from the headers list.
|
|
43
|
-
* If the 'next/headers' module is not available, it attempts to load it. If the
|
|
44
|
-
* headers function is available, it returns the primary language from the 'accept-language'
|
|
45
|
-
* header. If the headers function or 'accept-language' header is not available, returns null.
|
|
46
|
-
*
|
|
47
|
-
* @returns {Promise<string | null>} A promise that resolves to the primary language from the
|
|
48
|
-
* 'accept-language' header, or null if not available.
|
|
49
|
-
*/
|
|
50
|
-
export function getNextLocale() {
|
|
51
|
-
return __awaiter(this, arguments, void 0, function (defaultLocale, locales) {
|
|
52
|
-
var _a, headersList, cookieStore, userLocale;
|
|
53
|
-
if (defaultLocale === void 0) { defaultLocale = ''; }
|
|
54
|
-
return __generator(this, function (_b) {
|
|
55
|
-
switch (_b.label) {
|
|
56
|
-
case 0: return [4 /*yield*/, Promise.all([
|
|
57
|
-
headers(), cookies()
|
|
58
|
-
])];
|
|
59
|
-
case 1:
|
|
60
|
-
_a = _b.sent(), headersList = _a[0], cookieStore = _a[1];
|
|
61
|
-
userLocale = (function () {
|
|
62
|
-
var _a;
|
|
63
|
-
var preferredLocales = [];
|
|
64
|
-
// Language routed to by middleware
|
|
65
|
-
var headerLocale = headersList.get(localeHeaderName);
|
|
66
|
-
if (headerLocale)
|
|
67
|
-
preferredLocales.push(headerLocale);
|
|
68
|
-
var cookieLocale = cookieStore.get(localeCookieName);
|
|
69
|
-
if (cookieLocale === null || cookieLocale === void 0 ? void 0 : cookieLocale.value) {
|
|
70
|
-
preferredLocales.push(cookieLocale.value);
|
|
71
|
-
}
|
|
72
|
-
// Browser languages, in preference order
|
|
73
|
-
var acceptedLocales = (_a = headersList
|
|
74
|
-
.get('accept-language')) === null || _a === void 0 ? void 0 : _a.split(',').map(function (item) { var _a; return (_a = item.split(';')) === null || _a === void 0 ? void 0 : _a[0].trim(); });
|
|
75
|
-
if (acceptedLocales)
|
|
76
|
-
preferredLocales.push.apply(preferredLocales, acceptedLocales);
|
|
77
|
-
// add defaultLocale just in case there are no matches
|
|
78
|
-
preferredLocales.push(defaultLocale);
|
|
79
|
-
return determineLocale(preferredLocales, locales) || defaultLocale;
|
|
80
|
-
})();
|
|
81
|
-
return [2 /*return*/, userLocale];
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=getNextLocale.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getNextLocale.js","sourceRoot":"","sources":["../../../src/next/getNextLocale.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAoC,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;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;;;CAEnB"}
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
50
|
-
import { useCallback, useLayoutEffect, useState, } from 'react';
|
|
51
|
-
import { GTContext, useDynamicTranslation } from 'gt-react/client';
|
|
52
|
-
import { renderDefaultChildren, renderTranslatedChildren, renderSkeleton } from 'gt-react/internal';
|
|
53
|
-
import { extractEntryMetadata } from 'gt-react/internal';
|
|
54
|
-
import { renderContentToString } from 'generaltranslation';
|
|
55
|
-
import renderVariable from '../server/rendering/renderVariable';
|
|
56
|
-
import { createNoEntryWarning, createRequiredPrefixError } from '../errors/createErrors';
|
|
57
|
-
import { isTranslationPromise } from '../utils/checkTypes';
|
|
58
|
-
// meant to be used inside the server-side <GTProvider>
|
|
59
|
-
export default function ClientProvider(_a) {
|
|
60
|
-
var _this = this;
|
|
61
|
-
var children = _a.children, dictionary = _a.dictionary, initialTranslations = _a.initialTranslations, locale = _a.locale, defaultLocale = _a.defaultLocale, translationRequired = _a.translationRequired, regionalTranslationRequired = _a.regionalTranslationRequired, requiredPrefix = _a.requiredPrefix, renderSettings = _a.renderSettings, projectId = _a.projectId, devApiKey = _a.devApiKey, runtimeUrl = _a.runtimeUrl;
|
|
62
|
-
var _b = useState(null), translations = _b[0], setTranslations = _b[1];
|
|
63
|
-
useLayoutEffect(function () {
|
|
64
|
-
(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
65
|
-
var awaitedTranslations;
|
|
66
|
-
var _this = this;
|
|
67
|
-
return __generator(this, function (_a) {
|
|
68
|
-
switch (_a.label) {
|
|
69
|
-
case 0:
|
|
70
|
-
awaitedTranslations = {};
|
|
71
|
-
return [4 /*yield*/, Promise.all(Object.entries(initialTranslations).map(function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
72
|
-
var translation, error_1;
|
|
73
|
-
var _c;
|
|
74
|
-
var id = _b[0], translationEntry = _b[1];
|
|
75
|
-
return __generator(this, function (_d) {
|
|
76
|
-
switch (_d.label) {
|
|
77
|
-
case 0:
|
|
78
|
-
if (!isTranslationPromise(translationEntry)) return [3 /*break*/, 4];
|
|
79
|
-
_d.label = 1;
|
|
80
|
-
case 1:
|
|
81
|
-
_d.trys.push([1, 3, , 4]);
|
|
82
|
-
return [4 /*yield*/, translationEntry.promise];
|
|
83
|
-
case 2:
|
|
84
|
-
translation = _d.sent();
|
|
85
|
-
awaitedTranslations[id] = (_c = {}, _c[translationEntry.hash] = translation, _c);
|
|
86
|
-
return [3 /*break*/, 4];
|
|
87
|
-
case 3:
|
|
88
|
-
error_1 = _d.sent();
|
|
89
|
-
awaitedTranslations[id] = {
|
|
90
|
-
error: "An error occurred.",
|
|
91
|
-
code: 500
|
|
92
|
-
};
|
|
93
|
-
return [3 /*break*/, 4];
|
|
94
|
-
case 4: return [2 /*return*/];
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}); }))];
|
|
98
|
-
case 1:
|
|
99
|
-
_a.sent();
|
|
100
|
-
setTranslations(function (prev) { return (__assign(__assign({}, prev), awaitedTranslations)); });
|
|
101
|
-
return [2 /*return*/];
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}); })();
|
|
105
|
-
setTranslations(function (prev) { return (__assign(__assign({}, initialTranslations), prev)); });
|
|
106
|
-
}, []);
|
|
107
|
-
// For dictionaries
|
|
108
|
-
var translate = useCallback(function (id, options) {
|
|
109
|
-
var _a, _b, _c;
|
|
110
|
-
if (options === void 0) { options = {}; }
|
|
111
|
-
if (requiredPrefix && !(id === null || id === void 0 ? void 0 : id.startsWith(requiredPrefix)))
|
|
112
|
-
throw new Error(createRequiredPrefixError(id, requiredPrefix));
|
|
113
|
-
var dictionaryEntry = dictionary[id];
|
|
114
|
-
if (dictionaryEntry === undefined || dictionaryEntry === null ||
|
|
115
|
-
(typeof dictionaryEntry === 'object' && !Array.isArray(dictionaryEntry))) {
|
|
116
|
-
console.warn(createNoEntryWarning(id));
|
|
117
|
-
return undefined;
|
|
118
|
-
}
|
|
119
|
-
;
|
|
120
|
-
// Get the entry from the dictionary
|
|
121
|
-
var _d = extractEntryMetadata(dictionaryEntry), entry = _d.entry, metadata = _d.metadata;
|
|
122
|
-
// Initialize and populate variables and variables' metadata
|
|
123
|
-
var variables = options;
|
|
124
|
-
var variablesOptions = metadata === null || metadata === void 0 ? void 0 : metadata.variablesOptions;
|
|
125
|
-
// ----- RENDER METHODS ----- //
|
|
126
|
-
var renderString = function (content) {
|
|
127
|
-
return renderContentToString(content, [locale, defaultLocale], variables, variablesOptions);
|
|
128
|
-
};
|
|
129
|
-
var renderDefaultLocale = function () {
|
|
130
|
-
if (typeof entry === 'string')
|
|
131
|
-
return renderString(entry);
|
|
132
|
-
return renderDefaultChildren({
|
|
133
|
-
children: entry,
|
|
134
|
-
variables: variables,
|
|
135
|
-
variablesOptions: variablesOptions,
|
|
136
|
-
defaultLocale: defaultLocale,
|
|
137
|
-
renderVariable: renderVariable
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
var renderLoadingSkeleton = function () {
|
|
141
|
-
if (typeof entry === 'string')
|
|
142
|
-
return renderString('');
|
|
143
|
-
return renderSkeleton({
|
|
144
|
-
children: entry,
|
|
145
|
-
variables: variables,
|
|
146
|
-
defaultLocale: defaultLocale,
|
|
147
|
-
renderVariable: renderVariable
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
|
-
var renderLoadingHang = function () {
|
|
151
|
-
// TODO: double check that this has the desired behavior
|
|
152
|
-
if (typeof entry === 'string')
|
|
153
|
-
return renderString('');
|
|
154
|
-
return undefined;
|
|
155
|
-
};
|
|
156
|
-
var renderLoadingDefault = function () {
|
|
157
|
-
if (regionalTranslationRequired)
|
|
158
|
-
return renderDefaultLocale();
|
|
159
|
-
return renderLoadingSkeleton();
|
|
160
|
-
};
|
|
161
|
-
// render translated content
|
|
162
|
-
var renderTranslation = function (target) {
|
|
163
|
-
if (typeof entry === 'string')
|
|
164
|
-
return renderString(target);
|
|
165
|
-
return renderTranslatedChildren({
|
|
166
|
-
source: entry,
|
|
167
|
-
target: target,
|
|
168
|
-
variables: variables,
|
|
169
|
-
variablesOptions: variablesOptions,
|
|
170
|
-
locales: [locale, defaultLocale],
|
|
171
|
-
renderVariable: renderVariable
|
|
172
|
-
});
|
|
173
|
-
};
|
|
174
|
-
// ----- RENDER BEHAVIOR ----- //
|
|
175
|
-
// No tx required, so render default locale
|
|
176
|
-
if (!translationRequired)
|
|
177
|
-
return renderDefaultLocale();
|
|
178
|
-
// error behavior -> fallback to default language
|
|
179
|
-
if ((_a = translations === null || translations === void 0 ? void 0 : translations[id]) === null || _a === void 0 ? void 0 : _a.error) {
|
|
180
|
-
return renderDefaultLocale();
|
|
181
|
-
}
|
|
182
|
-
// loading behavior
|
|
183
|
-
if (!translations || ((_b = translations[id]) === null || _b === void 0 ? void 0 : _b.promise) || !((_c = translations[id]) === null || _c === void 0 ? void 0 : _c[metadata === null || metadata === void 0 ? void 0 : metadata.hash])) {
|
|
184
|
-
if (renderSettings.method === 'skeleton') {
|
|
185
|
-
return renderLoadingSkeleton();
|
|
186
|
-
}
|
|
187
|
-
if (renderSettings.method === 'replace') {
|
|
188
|
-
return renderDefaultLocale();
|
|
189
|
-
}
|
|
190
|
-
if (renderSettings.method === 'hang') {
|
|
191
|
-
return renderLoadingHang();
|
|
192
|
-
}
|
|
193
|
-
if (renderSettings.method === 'subtle') {
|
|
194
|
-
return renderDefaultLocale();
|
|
195
|
-
}
|
|
196
|
-
return renderLoadingDefault();
|
|
197
|
-
}
|
|
198
|
-
var translation = translations === null || translations === void 0 ? void 0 : translations[id];
|
|
199
|
-
return renderTranslation(translation === null || translation === void 0 ? void 0 : translation[metadata === null || metadata === void 0 ? void 0 : metadata.hash]);
|
|
200
|
-
}, [dictionary, translations]);
|
|
201
|
-
// For <T> components
|
|
202
|
-
var _c = useDynamicTranslation({
|
|
203
|
-
targetLocale: locale,
|
|
204
|
-
projectId: projectId,
|
|
205
|
-
devApiKey: devApiKey,
|
|
206
|
-
runtimeUrl: runtimeUrl,
|
|
207
|
-
setTranslations: setTranslations,
|
|
208
|
-
defaultLocale: defaultLocale
|
|
209
|
-
}), translateChildren = _c.translateChildren, translateContent = _c.translateContent;
|
|
210
|
-
return (_jsx(GTContext.Provider, { value: {
|
|
211
|
-
translate: translate,
|
|
212
|
-
translateChildren: translateChildren,
|
|
213
|
-
translateContent: translateContent,
|
|
214
|
-
locale: locale,
|
|
215
|
-
defaultLocale: defaultLocale,
|
|
216
|
-
translations: translations,
|
|
217
|
-
translationRequired: translationRequired,
|
|
218
|
-
regionalTranslationRequired: regionalTranslationRequired,
|
|
219
|
-
renderSettings: renderSettings,
|
|
220
|
-
}, children: translations && children }));
|
|
221
|
-
}
|
|
222
|
-
//# sourceMappingURL=ClientProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClientProvider.js","sourceRoot":"","sources":["../../../src/provider/ClientProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,OAAO,EACL,WAAW,EACX,eAAe,EACf,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EACL,SAAS,EAAE,qBAAqB,EACjC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAA4B,cAAc,EAA0C,MAAM,mBAAmB,CAAC;AACtK,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAEzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,uDAAuD;AACvD,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EA6BtC;IA7BD,iBA4LC;QA3LC,QAAQ,cAAA,EACR,UAAU,gBAAA,EACV,mBAAmB,yBAAA,EACnB,MAAM,YAAA,EACN,aAAa,mBAAA,EACb,mBAAmB,yBAAA,EACnB,2BAA2B,iCAAA,EAC3B,cAAc,oBAAA,EACd,cAAc,oBAAA,EACd,SAAS,eAAA,EACT,SAAS,eAAA,EACT,UAAU,gBAAA;IAmBJ,IAAA,KAAkC,QAAQ,CAA6B,IAAI,CAAC,EAA3E,YAAY,QAAA,EAAE,eAAe,QAA8C,CAAC;IAEnF,eAAe,CAAC;QACd,CAAC;;;;;;wBACO,mBAAmB,GAAuB,EAAE,CAAC;wBACnD,qBAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,OAAO,CAAC,mBAAmB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C;YACD,IAAI,cAAc,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;gBACvC,OAAO,mBAAmB,EAAE,CAAC;YAC/B,CAAC;YACD,OAAO,oBAAoB,EAAE,CAAC;QAChC,CAAC;QAED,IAAM,WAAW,GAAG,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,EAAE,CAAC,CAAC;QACvC,OAAO,iBAAiB,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,CAAC,CAAC,CAAC;IAC1D,CAAC,EACD,CAAC,UAAU,EAAE,YAAY,CAAC,CAC3B,CAAC;IAEF,qBAAqB;IACf,IAAA,KAA0C,qBAAqB,CAAC;QACpE,YAAY,EAAE,MAAM;QAAE,SAAS,WAAA;QAAE,SAAS,WAAA;QAAE,UAAU,YAAA;QAAE,eAAe,iBAAA;QAAE,aAAa,eAAA;KACvF,CAAC,EAFM,iBAAiB,uBAAA,EAAE,gBAAgB,sBAEzC,CAAC;IAEH,OAAO,CACL,KAAC,SAAS,CAAC,QAAQ,IACjB,KAAK,EAAE;YACL,SAAS,WAAA;YAAE,iBAAiB,mBAAA;YAAE,gBAAgB,kBAAA;YAC9C,MAAM,QAAA;YACN,aAAa,eAAA;YACb,YAAY,cAAA;YACZ,mBAAmB,qBAAA;YACnB,2BAA2B,6BAAA;YAC3B,cAAc,gBAAA;SACf,YAEA,YAAY,IAAI,QAAQ,GACN,CACtB,CAAC;AACJ,CAAC"}
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
49
|
-
import React from 'react';
|
|
50
|
-
import { flattenDictionary, extractEntryMetadata, } from 'gt-react/internal';
|
|
51
|
-
import getI18NConfig from '../config/getI18NConfig';
|
|
52
|
-
import getLocale from '../request/getLocale';
|
|
53
|
-
import getMetadata from '../request/getMetadata';
|
|
54
|
-
import { splitStringToContent } from 'generaltranslation';
|
|
55
|
-
import getDictionary, { getDictionaryEntry } from '../dictionary/getDictionary';
|
|
56
|
-
import ClientProvider from './ClientProvider';
|
|
57
|
-
import { createDictionarySubsetError } from '../errors/createErrors';
|
|
58
|
-
import { GTTranslationError, } from '../types/types';
|
|
59
|
-
/**
|
|
60
|
-
* Provides General Translation context to its children, which can then access `useGT`, `useLocale`, and `useDefaultLocale`.
|
|
61
|
-
*
|
|
62
|
-
* @param {React.ReactNode} children - The children components that will use the translation context.
|
|
63
|
-
* @param {string} id - ID of a nested dictionary, so that only a subset of a large dictionary needs to be sent to the client.
|
|
64
|
-
*
|
|
65
|
-
* @returns {JSX.Element} The provider component for General Translation context.
|
|
66
|
-
*/
|
|
67
|
-
export default function GTProvider(_a) {
|
|
68
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
69
|
-
var getId, I18NConfig, locale, additionalMetadata, defaultLocale, renderSettings, regionalTranslationRequired, translationRequired, translationsPromise, dictionarySubset, dictionaryEntries, dictionary, translations, existingTranslations, _c;
|
|
70
|
-
var _this = this;
|
|
71
|
-
var children = _b.children, id = _b.id;
|
|
72
|
-
return __generator(this, function (_d) {
|
|
73
|
-
switch (_d.label) {
|
|
74
|
-
case 0:
|
|
75
|
-
getId = function (suffix) {
|
|
76
|
-
return id ? "".concat(id, ".").concat(suffix) : suffix;
|
|
77
|
-
};
|
|
78
|
-
I18NConfig = getI18NConfig();
|
|
79
|
-
return [4 /*yield*/, getLocale()];
|
|
80
|
-
case 1:
|
|
81
|
-
locale = _d.sent();
|
|
82
|
-
return [4 /*yield*/, getMetadata()];
|
|
83
|
-
case 2:
|
|
84
|
-
additionalMetadata = _d.sent();
|
|
85
|
-
defaultLocale = I18NConfig.getDefaultLocale();
|
|
86
|
-
renderSettings = I18NConfig.getRenderSettings();
|
|
87
|
-
regionalTranslationRequired = I18NConfig.requiresRegionalTranslation(locale);
|
|
88
|
-
translationRequired = I18NConfig.requiresTranslation(locale) || regionalTranslationRequired;
|
|
89
|
-
if (translationRequired)
|
|
90
|
-
translationsPromise = I18NConfig.getTranslations(locale);
|
|
91
|
-
dictionarySubset = (id ? getDictionaryEntry(id) : getDictionary()) || {};
|
|
92
|
-
if (typeof dictionarySubset !== 'object' || Array.isArray(dictionarySubset))
|
|
93
|
-
throw new Error(createDictionarySubsetError(id !== null && id !== void 0 ? id : '', "<GTProvider>"));
|
|
94
|
-
dictionaryEntries = flattenDictionary(dictionarySubset);
|
|
95
|
-
dictionary = {};
|
|
96
|
-
translations = {};
|
|
97
|
-
if (!(translationsPromise)) return [3 /*break*/, 4];
|
|
98
|
-
return [4 /*yield*/, translationsPromise];
|
|
99
|
-
case 3:
|
|
100
|
-
_c = _d.sent();
|
|
101
|
-
return [3 /*break*/, 5];
|
|
102
|
-
case 4:
|
|
103
|
-
_c = {};
|
|
104
|
-
_d.label = 5;
|
|
105
|
-
case 5:
|
|
106
|
-
existingTranslations = _c;
|
|
107
|
-
// Check and standardize flattened dictionary entries before passing them to the client
|
|
108
|
-
return [4 /*yield*/, Promise.all(Object.entries(dictionaryEntries !== null && dictionaryEntries !== void 0 ? dictionaryEntries : {}).map(function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
109
|
-
var entryId, _c, entry, metadata, taggedEntry, contentArray, _d, _, hash_1, translation_1, translationPromise_1, _e, _f, _g, error_1, result, _h, entryAsObjects, hash, translation, translationPromise, _j, _k, _l, loadingFallback, errorFallback;
|
|
110
|
-
var _m, _o, _p, _q;
|
|
111
|
-
var suffix = _b[0], dictionaryEntry = _b[1];
|
|
112
|
-
return __generator(this, function (_r) {
|
|
113
|
-
switch (_r.label) {
|
|
114
|
-
case 0:
|
|
115
|
-
entryId = getId(suffix);
|
|
116
|
-
_c = extractEntryMetadata(dictionaryEntry), entry = _c.entry, metadata = _c.metadata;
|
|
117
|
-
if (typeof entry === 'undefined')
|
|
118
|
-
return [2 /*return*/];
|
|
119
|
-
taggedEntry = I18NConfig.addGTIdentifier(entry, entryId);
|
|
120
|
-
// If no translation is required, return
|
|
121
|
-
if (!translationRequired)
|
|
122
|
-
return [2 /*return*/, dictionary[entryId] = [taggedEntry, __assign({}, metadata)]];
|
|
123
|
-
if (!(typeof taggedEntry === 'string')) return [3 /*break*/, 5];
|
|
124
|
-
contentArray = splitStringToContent(taggedEntry);
|
|
125
|
-
_d = I18NConfig.serializeAndHash(contentArray, metadata === null || metadata === void 0 ? void 0 : metadata.context, entryId), _ = _d[0], hash_1 = _d[1];
|
|
126
|
-
dictionary[entryId] = [taggedEntry, __assign(__assign({}, metadata), { hash: hash_1 })];
|
|
127
|
-
translation_1 = existingTranslations === null || existingTranslations === void 0 ? void 0 : existingTranslations[entryId];
|
|
128
|
-
if (translation_1 === null || translation_1 === void 0 ? void 0 : translation_1[hash_1])
|
|
129
|
-
return [2 /*return*/, (translations[entryId] = (_m = {}, _m[hash_1] = translation_1[hash_1], _m))];
|
|
130
|
-
translationPromise_1 = I18NConfig.translateContent({
|
|
131
|
-
source: contentArray,
|
|
132
|
-
targetLocale: locale,
|
|
133
|
-
options: __assign({ id: entryId, hash: hash_1 }, additionalMetadata),
|
|
134
|
-
});
|
|
135
|
-
if (renderSettings.method === "skeleton") {
|
|
136
|
-
return [2 /*return*/, translations[entryId] = {
|
|
137
|
-
promise: translationPromise_1,
|
|
138
|
-
hash: hash_1,
|
|
139
|
-
type: 'content'
|
|
140
|
-
}];
|
|
141
|
-
}
|
|
142
|
-
if (renderSettings.method === "replace") {
|
|
143
|
-
return [2 /*return*/, translations[entryId] = {
|
|
144
|
-
promise: translationPromise_1,
|
|
145
|
-
hash: hash_1,
|
|
146
|
-
type: 'content'
|
|
147
|
-
}];
|
|
148
|
-
}
|
|
149
|
-
if (renderSettings.method === "default") {
|
|
150
|
-
return [2 /*return*/, translations[entryId] = {
|
|
151
|
-
promise: translationPromise_1,
|
|
152
|
-
hash: hash_1,
|
|
153
|
-
type: 'content'
|
|
154
|
-
}];
|
|
155
|
-
}
|
|
156
|
-
if (!(renderSettings.method === "hang")) return [3 /*break*/, 4];
|
|
157
|
-
_r.label = 1;
|
|
158
|
-
case 1:
|
|
159
|
-
_r.trys.push([1, 3, , 4]);
|
|
160
|
-
_e = translations;
|
|
161
|
-
_f = entryId;
|
|
162
|
-
_o = {};
|
|
163
|
-
_g = hash_1;
|
|
164
|
-
return [4 /*yield*/, translationPromise_1];
|
|
165
|
-
case 2:
|
|
166
|
-
_e[_f] = (_o[_g] = _r.sent(),
|
|
167
|
-
_o);
|
|
168
|
-
return [3 /*break*/, 4];
|
|
169
|
-
case 3:
|
|
170
|
-
error_1 = _r.sent();
|
|
171
|
-
result = void 0;
|
|
172
|
-
if (error_1 instanceof GTTranslationError) {
|
|
173
|
-
result = error_1.toTranslationError();
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
result = {
|
|
177
|
-
error: "An unknonwn error occured",
|
|
178
|
-
code: 500
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
translations[entryId] = result;
|
|
182
|
-
return [3 /*break*/, 4];
|
|
183
|
-
case 4:
|
|
184
|
-
// Subtle rendering
|
|
185
|
-
return [2 /*return*/, undefined];
|
|
186
|
-
case 5:
|
|
187
|
-
_h = I18NConfig.serializeAndHash(taggedEntry, metadata === null || metadata === void 0 ? void 0 : metadata.context, entryId), entryAsObjects = _h[0], hash = _h[1];
|
|
188
|
-
dictionary[entryId] = [taggedEntry, __assign(__assign({}, metadata), { hash: hash })];
|
|
189
|
-
translation = existingTranslations === null || existingTranslations === void 0 ? void 0 : existingTranslations[entryId];
|
|
190
|
-
if (translation === null || translation === void 0 ? void 0 : translation[hash])
|
|
191
|
-
return [2 /*return*/, (translations[entryId] = (_p = {}, _p[hash] = translation[hash], _p))];
|
|
192
|
-
translationPromise = I18NConfig.translateChildren({
|
|
193
|
-
source: entryAsObjects,
|
|
194
|
-
targetLocale: locale,
|
|
195
|
-
metadata: __assign(__assign({ id: entryId, hash: hash }, additionalMetadata), (renderSettings.timeout && { timeout: renderSettings.timeout })),
|
|
196
|
-
});
|
|
197
|
-
if (renderSettings.method === "subtle")
|
|
198
|
-
return [2 /*return*/, undefined];
|
|
199
|
-
if (!(renderSettings.method === "hang")) return [3 /*break*/, 7];
|
|
200
|
-
_j = translations;
|
|
201
|
-
_k = entryId;
|
|
202
|
-
_q = {};
|
|
203
|
-
_l = hash;
|
|
204
|
-
return [4 /*yield*/, translationPromise];
|
|
205
|
-
case 6: return [2 /*return*/, (_j[_k] = (_q[_l] = _r.sent(), _q))];
|
|
206
|
-
case 7:
|
|
207
|
-
if (renderSettings.method === 'skeleton') {
|
|
208
|
-
loadingFallback = _jsx(React.Fragment, {}, "skeleton_".concat(entryId));
|
|
209
|
-
}
|
|
210
|
-
return [2 /*return*/, (translations[entryId] = {
|
|
211
|
-
promise: translationPromise,
|
|
212
|
-
hash: hash,
|
|
213
|
-
type: 'jsx',
|
|
214
|
-
})];
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
}); }))];
|
|
218
|
-
case 6:
|
|
219
|
-
// Check and standardize flattened dictionary entries before passing them to the client
|
|
220
|
-
_d.sent();
|
|
221
|
-
return [2 /*return*/, (_jsx(ClientProvider, __assign({ dictionary: dictionary, initialTranslations: __assign(__assign({}, existingTranslations), translations), locale: locale, defaultLocale: defaultLocale, translationRequired: translationRequired, regionalTranslationRequired: regionalTranslationRequired, requiredPrefix: id, renderSettings: I18NConfig.getRenderSettings() }, I18NConfig.getClientSideConfig(), { children: children })))];
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
//# sourceMappingURL=GTProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GTProvider.js","sourceRoot":"","sources":["../../../src/provider/GTProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAC7C,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,aAAa,EAAE,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAgB,kBAAkB,GAAG,MAAM,gBAAgB,CAAC;AAInE;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAgB,UAAU;wDAAC,EAMxC;;;YALC,QAAQ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