gt-next 6.1.1 → 6.1.2
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/CHANGELOG.md +9 -0
- package/dist/client.d.ts +2 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -1
- package/dist/client.js.map +1 -1
- package/dist/index.client.d.ts +2 -2
- package/dist/index.client.d.ts.map +1 -1
- package/dist/index.client.js +2 -1
- package/dist/index.client.js.map +1 -1
- package/dist/index.server.d.ts +2 -1
- package/dist/index.server.d.ts.map +1 -1
- package/dist/index.server.js +3 -1
- package/dist/index.server.js.map +1 -1
- package/dist/index.types.d.ts +14 -1
- package/dist/index.types.d.ts.map +1 -1
- package/dist/index.types.js +17 -1
- package/dist/index.types.js.map +1 -1
- package/dist/request/getLocaleDirection.d.ts +27 -0
- package/dist/request/getLocaleDirection.d.ts.map +1 -0
- package/dist/request/getLocaleDirection.js +94 -0
- package/dist/request/getLocaleDirection.js.map +1 -0
- package/dist/server.d.ts +2 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +3 -1
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# gt-next
|
|
2
2
|
|
|
3
|
+
## 6.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#559](https://github.com/generaltranslation/gt/pull/559) [`5b93faf`](https://github.com/generaltranslation/gt/commit/5b93faf28001c579e293d027651889be44ea366e) Thanks [@archie-mckenzie](https://github.com/archie-mckenzie)! - Added useLocaleDirection hook and async getLocaleDirection function
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`5b93faf`](https://github.com/generaltranslation/gt/commit/5b93faf28001c579e293d027651889be44ea366e)]:
|
|
10
|
+
- gt-react@10.2.1
|
|
11
|
+
|
|
3
12
|
## 6.1.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/client.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { T, useGT, useLocale, useDefaultLocale, LocaleSelector, RegionSelector, GTProvider, useLocales, useSetLocale, useLocaleSelector, Var, Currency, DateTime, Num, Plural, Branch, useLocaleProperties, useGTClass, useTranslations, useRegion, useRegionSelector } from 'gt-react/client';
|
|
2
|
-
export { useGT, useTranslations, useLocale, useLocales, useSetLocale, useDefaultLocale, useLocaleSelector, useRegion, useRegionSelector, useGTClass, useLocaleProperties, GTProvider as GTClientProvider, T, Var, Currency, DateTime, Num, Plural, Branch, LocaleSelector, RegionSelector, };
|
|
1
|
+
import { T, useGT, useLocale, useDefaultLocale, LocaleSelector, RegionSelector, GTProvider, useLocales, useSetLocale, useLocaleSelector, Var, Currency, DateTime, Num, Plural, Branch, useLocaleProperties, useGTClass, useTranslations, useRegion, useRegionSelector, useLocaleDirection } from 'gt-react/client';
|
|
2
|
+
export { useGT, useTranslations, useLocale, useLocales, useSetLocale, useDefaultLocale, useLocaleSelector, useRegion, useRegionSelector, useGTClass, useLocaleProperties, useLocaleDirection, GTProvider as GTClientProvider, T, Var, Currency, DateTime, Num, Plural, Branch, LocaleSelector, RegionSelector, };
|
|
3
3
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,CAAC,EACD,KAAK,EACL,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,UAAU,EACV,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,MAAM,EACN,MAAM,EACN,mBAAmB,EACnB,UAAU,EACV,eAAe,EACf,SAAS,EACT,iBAAiB,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,CAAC,EACD,KAAK,EACL,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,UAAU,EACV,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,MAAM,EACN,MAAM,EACN,mBAAmB,EACnB,UAAU,EACV,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAEL,KAAK,EACL,eAAe,EACf,SAAS,EACT,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAElB,UAAU,IAAI,gBAAgB,EAC9B,CAAC,EACD,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,MAAM,EACN,MAAM,EACN,cAAc,EACd,cAAc,GACf,CAAC"}
|
package/dist/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.RegionSelector = exports.LocaleSelector = exports.Branch = exports.Plural = exports.Num = exports.DateTime = exports.Currency = exports.Var = exports.T = exports.GTClientProvider = exports.useLocaleProperties = exports.useGTClass = exports.useRegionSelector = exports.useRegion = exports.useLocaleSelector = exports.useDefaultLocale = exports.useSetLocale = exports.useLocales = exports.useLocale = exports.useTranslations = exports.useGT = void 0;
|
|
4
|
+
exports.RegionSelector = exports.LocaleSelector = exports.Branch = exports.Plural = exports.Num = exports.DateTime = exports.Currency = exports.Var = exports.T = exports.GTClientProvider = exports.useLocaleDirection = exports.useLocaleProperties = exports.useGTClass = exports.useRegionSelector = exports.useRegion = exports.useLocaleSelector = exports.useDefaultLocale = exports.useSetLocale = exports.useLocales = exports.useLocale = exports.useTranslations = exports.useGT = void 0;
|
|
5
5
|
var client_1 = require("gt-react/client");
|
|
6
6
|
Object.defineProperty(exports, "T", { enumerable: true, get: function () { return client_1.T; } });
|
|
7
7
|
Object.defineProperty(exports, "useGT", { enumerable: true, get: function () { return client_1.useGT; } });
|
|
@@ -24,4 +24,5 @@ Object.defineProperty(exports, "useGTClass", { enumerable: true, get: function (
|
|
|
24
24
|
Object.defineProperty(exports, "useTranslations", { enumerable: true, get: function () { return client_1.useTranslations; } });
|
|
25
25
|
Object.defineProperty(exports, "useRegion", { enumerable: true, get: function () { return client_1.useRegion; } });
|
|
26
26
|
Object.defineProperty(exports, "useRegionSelector", { enumerable: true, get: function () { return client_1.useRegionSelector; } });
|
|
27
|
+
Object.defineProperty(exports, "useLocaleDirection", { enumerable: true, get: function () { return client_1.useLocaleDirection; } });
|
|
27
28
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AACb,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AACb,0CAuByB;AAkBvB,kFAxCA,UAAC,OAwCA;AAdD,sFAzBA,cAAK,OAyBA;AAEL,0FA1BA,kBAAS,OA0BA;AAGT,iGA5BA,yBAAgB,OA4BA;AAgBhB,+FA3CA,uBAAc,OA2CA;AACd,+FA3CA,uBAAc,OA2CA;AATA,iGAjCd,mBAAU,OAiCoB;AAV9B,2FAtBA,mBAAU,OAsBA;AACV,6FAtBA,qBAAY,OAsBA;AAEZ,kGAvBA,0BAAiB,OAuBA;AASjB,oFA/BA,YAAG,OA+BA;AACH,yFA/BA,iBAAQ,OA+BA;AACR,yFA/BA,iBAAQ,OA+BA;AACR,oFA/BA,YAAG,OA+BA;AACH,uFA/BA,eAAM,OA+BA;AACN,uFA/BA,eAAM,OA+BA;AAVN,oGApBA,4BAAmB,OAoBA;AADnB,2FAlBA,mBAAU,OAkBA;AARV,gGATA,wBAAe,OASA;AAMf,0FAdA,kBAAS,OAcA;AACT,kGAdA,0BAAiB,OAcA;AAGjB,mGAhBA,2BAAkB,OAgBA"}
|
package/dist/index.client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Var, Num, Currency, DateTime, T, Branch, Plural, LocaleSelector, RegionSelector, useGT, useTranslations, useLocale, useLocales, useDefaultLocale, useGTClass, useLocaleProperties } from 'gt-react/client';
|
|
1
|
+
import { Var, Num, Currency, DateTime, T, Branch, Plural, LocaleSelector, RegionSelector, useGT, useTranslations, useLocale, useLocales, useDefaultLocale, useGTClass, useLocaleProperties, useLocaleDirection } from 'gt-react/client';
|
|
2
2
|
import { DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions } from 'gt-react';
|
|
3
3
|
export declare function GTProvider(): void;
|
|
4
4
|
export declare function Tx(): void;
|
|
5
|
-
export { T, Var, Num, Currency, DateTime, Branch, Plural, LocaleSelector, RegionSelector, useGT, useTranslations, useLocale, useLocales, useDefaultLocale, useGTClass, useLocaleProperties, DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions, };
|
|
5
|
+
export { T, Var, Num, Currency, DateTime, Branch, Plural, LocaleSelector, RegionSelector, useGT, useTranslations, useLocale, useLocales, useDefaultLocale, useGTClass, useLocaleProperties, useLocaleDirection, DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions, };
|
|
6
6
|
//# sourceMappingURL=index.client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../src/index.client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,CAAC,EACD,MAAM,EACN,MAAM,EACN,cAAc,EACd,cAAc,EACd,KAAK,EACL,eAAe,EACf,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../src/index.client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,CAAC,EACD,MAAM,EACN,MAAM,EACN,cAAc,EACd,cAAc,EACd,KAAK,EACL,eAAe,EACf,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,UAAU,CAAC;AAGlB,wBAAgB,UAAU,SAEzB;AAGD,wBAAgB,EAAE,SAEjB;AAED,OAAO,EACL,CAAC,EACD,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,MAAM,EACN,cAAc,EACd,cAAc,EACd,KAAK,EACL,eAAe,EACf,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,GAC1B,CAAC"}
|
package/dist/index.client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.useLocaleProperties = exports.useGTClass = exports.useDefaultLocale = exports.useLocales = exports.useLocale = exports.useTranslations = exports.useGT = exports.RegionSelector = exports.LocaleSelector = exports.Plural = exports.Branch = exports.DateTime = exports.Currency = exports.Num = exports.Var = exports.T = void 0;
|
|
4
|
+
exports.useLocaleDirection = exports.useLocaleProperties = exports.useGTClass = exports.useDefaultLocale = exports.useLocales = exports.useLocale = exports.useTranslations = exports.useGT = exports.RegionSelector = exports.LocaleSelector = exports.Plural = exports.Branch = exports.DateTime = exports.Currency = exports.Num = exports.Var = exports.T = void 0;
|
|
5
5
|
exports.GTProvider = GTProvider;
|
|
6
6
|
exports.Tx = Tx;
|
|
7
7
|
var client_1 = require("gt-react/client");
|
|
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "useLocales", { enumerable: true, get: function (
|
|
|
21
21
|
Object.defineProperty(exports, "useDefaultLocale", { enumerable: true, get: function () { return client_1.useDefaultLocale; } });
|
|
22
22
|
Object.defineProperty(exports, "useGTClass", { enumerable: true, get: function () { return client_1.useGTClass; } });
|
|
23
23
|
Object.defineProperty(exports, "useLocaleProperties", { enumerable: true, get: function () { return client_1.useLocaleProperties; } });
|
|
24
|
+
Object.defineProperty(exports, "useLocaleDirection", { enumerable: true, get: function () { return client_1.useLocaleDirection; } });
|
|
24
25
|
var createErrors_1 = require("./errors/createErrors");
|
|
25
26
|
// Mock <GTProvider> which throws an error
|
|
26
27
|
function GTProvider() {
|
package/dist/index.client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.js","sourceRoot":"","sources":["../src/index.client.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;
|
|
1
|
+
{"version":3,"file":"index.client.js","sourceRoot":"","sources":["../src/index.client.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAgCb,gCAEC;AAGD,gBAEC;AArCD,0CAkByB;AAuBvB,oFAxCA,YAAG,OAwCA;AACH,oFAxCA,YAAG,OAwCA;AACH,yFAxCA,iBAAQ,OAwCA;AACR,yFAxCA,iBAAQ,OAwCA;AAJR,kFAnCA,UAAC,OAmCA;AAKD,uFAvCA,eAAM,OAuCA;AACN,uFAvCA,eAAM,OAuCA;AACN,+FAvCA,uBAAc,OAuCA;AACd,+FAvCA,uBAAc,OAuCA;AACd,sFAvCA,cAAK,OAuCA;AACL,gGAvCA,wBAAe,OAuCA;AACf,0FAvCA,kBAAS,OAuCA;AACT,2FAvCA,mBAAU,OAuCA;AACV,iGAvCA,yBAAgB,OAuCA;AAChB,2FAvCA,mBAAU,OAuCA;AACV,oGAvCA,4BAAmB,OAuCA;AACnB,mGAvCA,2BAAkB,OAuCA;AArCpB,sDAG+B;AAO/B,0CAA0C;AAC1C,SAAgB,UAAU;IACxB,MAAM,IAAI,KAAK,CAAC,uCAAwB,CAAC,CAAC;AAC5C,CAAC;AAED,kCAAkC;AAClC,SAAgB,EAAE;IAChB,MAAM,IAAI,KAAK,CAAC,+BAAgB,CAAC,CAAC;AACpC,CAAC"}
|
package/dist/index.server.d.ts
CHANGED
|
@@ -10,11 +10,12 @@ import { Tx } from './server';
|
|
|
10
10
|
import { useGT } from './server-dir/buildtime/getGT';
|
|
11
11
|
import { useTranslations } from './server-dir/buildtime/getTranslations';
|
|
12
12
|
import { useLocale } from './request/getLocale';
|
|
13
|
+
import { useLocaleDirection } from './request/getLocaleDirection';
|
|
13
14
|
import { DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions } from 'gt-react';
|
|
14
15
|
export { LocaleSelector, RegionSelector } from './index.client';
|
|
15
16
|
export declare function useGTClass(): import("generaltranslation").GT;
|
|
16
17
|
export declare function useLocaleProperties(locale: string): import("generaltranslation/dist/locales/getLocaleProperties").LocaleProperties;
|
|
17
18
|
export declare function useLocales(): string[];
|
|
18
19
|
export declare function useDefaultLocale(): string;
|
|
19
|
-
export { GTProvider, T, Tx, Var, Num, Currency, DateTime, Branch, Plural, useGT, useTranslations, useLocale, DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions, };
|
|
20
|
+
export { GTProvider, T, Tx, Var, Num, Currency, DateTime, Branch, Plural, useGT, useTranslations, useLocale, useLocaleDirection, DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions, };
|
|
20
21
|
//# sourceMappingURL=index.server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,iBAAiB,CAAC;AAClC,OAAO,GAAG,MAAM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AgB,CAAC;AAEhE,wBAAgB,UAAU,oCAEzB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,kFAEjD;AAED,wBAAgB,UAAU,aAEzB;AAED,wBAAgB,gBAAgB,WAE/B;AAED,OAAO,EACL,UAAU,EACV,CAAC,EACD,EAAE,EACF,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,EACL,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,GAC1B,CAAC"}
|
package/dist/index.server.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useLocale = exports.useTranslations = exports.useGT = exports.Plural = exports.Branch = exports.DateTime = exports.Currency = exports.Num = exports.Var = exports.Tx = exports.T = exports.GTProvider = exports.RegionSelector = exports.LocaleSelector = void 0;
|
|
6
|
+
exports.useLocaleDirection = exports.useLocale = exports.useTranslations = exports.useGT = exports.Plural = exports.Branch = exports.DateTime = exports.Currency = exports.Num = exports.Var = exports.Tx = exports.T = exports.GTProvider = exports.RegionSelector = exports.LocaleSelector = void 0;
|
|
7
7
|
exports.useGTClass = useGTClass;
|
|
8
8
|
exports.useLocaleProperties = useLocaleProperties;
|
|
9
9
|
exports.useLocales = useLocales;
|
|
@@ -32,6 +32,8 @@ var getTranslations_1 = require("./server-dir/buildtime/getTranslations");
|
|
|
32
32
|
Object.defineProperty(exports, "useTranslations", { enumerable: true, get: function () { return getTranslations_1.useTranslations; } });
|
|
33
33
|
var getLocale_1 = require("./request/getLocale");
|
|
34
34
|
Object.defineProperty(exports, "useLocale", { enumerable: true, get: function () { return getLocale_1.useLocale; } });
|
|
35
|
+
var getLocaleDirection_1 = require("./request/getLocaleDirection");
|
|
36
|
+
Object.defineProperty(exports, "useLocaleDirection", { enumerable: true, get: function () { return getLocaleDirection_1.useLocaleDirection; } });
|
|
35
37
|
var getI18NConfig_1 = __importDefault(require("./config-dir/getI18NConfig"));
|
|
36
38
|
var index_client_1 = require("./index.client");
|
|
37
39
|
Object.defineProperty(exports, "LocaleSelector", { enumerable: true, get: function () { return index_client_1.LocaleSelector; } });
|
package/dist/index.server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.js","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.server.js","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":";;;;;;AAsBA,gCAEC;AAED,kDAEC;AAED,gCAEC;AAED,4CAEC;AApCD,wDAAkC;AA0ChC,cA1CK,aAAG,CA0CL;AAzCL,wDAAkC;AA0ChC,cA1CK,aAAG,CA0CL;AAzCL,kEAA4C;AA0C1C,mBA1CK,kBAAQ,CA0CL;AAzCV,kEAA4C;AA0C1C,mBA1CK,kBAAQ,CA0CL;AAzCV,+DAAyC;AAoCvC,YApCK,WAAC,CAoCL;AAnCH,6DAAuC;AAyCrC,iBAzCK,gBAAM,CAyCL;AAxCR,6DAAuC;AAyCrC,iBAzCK,gBAAM,CAyCL;AAxCR,qEAA+C;AAgC7C,qBAhCK,oBAAU,CAgCL;AA/BZ,mCAA8B;AAiC5B,mFAjCO,WAAE,OAiCP;AAhCJ,sDAAqD;AAuCnD,sFAvCO,aAAK,OAuCP;AAtCP,0EAAyE;AAuCvE,gGAvCO,iCAAe,OAuCP;AAtCjB,iDAAgD;AAuC9C,0FAvCO,qBAAS,OAuCP;AAtCX,mEAAkE;AAuChE,mGAvCO,uCAAkB,OAuCP;AAtCpB,6EAAuD;AAOvD,+CAAgE;AAAvD,8GAAA,cAAc,OAAA;AAAE,8GAAA,cAAc,OAAA;AAEvC,SAAgB,UAAU;IACxB,OAAO,IAAA,uBAAa,GAAE,CAAC,UAAU,EAAE,CAAC;AACtC,CAAC;AAED,SAAgB,mBAAmB,CAAC,MAAc;IAChD,OAAO,UAAU,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAClD,CAAC;AAED,SAAgB,UAAU;IACxB,OAAO,IAAA,uBAAa,GAAE,CAAC,UAAU,EAAE,CAAC;AACtC,CAAC;AAED,SAAgB,gBAAgB;IAC9B,OAAO,IAAA,uBAAa,GAAE,CAAC,gBAAgB,EAAE,CAAC;AAC5C,CAAC"}
|
package/dist/index.types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _GTProvider from './provider/GTProvider';
|
|
2
2
|
import _T from './server-dir/buildtime/T';
|
|
3
|
-
import { useGT as _useGT, useTranslations as _useTranslations, useLocale as _useLocale, useLocales as _useLocales, useDefaultLocale as _useDefaultLocale, useGTClass as _useGTClass, useLocaleProperties as _useLocaleProperties, Currency as _Currency, DateTime as _DateTime, Num as _Num, Var as _Var, Branch as _Branch, Plural as _Plural, LocaleSelector as _LocaleSelector, RegionSelector as _RegionSelector } from 'gt-react/client';
|
|
3
|
+
import { useGT as _useGT, useTranslations as _useTranslations, useLocale as _useLocale, useLocales as _useLocales, useDefaultLocale as _useDefaultLocale, useGTClass as _useGTClass, useLocaleProperties as _useLocaleProperties, Currency as _Currency, DateTime as _DateTime, Num as _Num, Var as _Var, Branch as _Branch, Plural as _Plural, LocaleSelector as _LocaleSelector, RegionSelector as _RegionSelector, useLocaleDirection as _useLocaleDirection } from 'gt-react/client';
|
|
4
4
|
import { DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions } from 'gt-react';
|
|
5
5
|
/**
|
|
6
6
|
* Provides General Translation context to its children, which can then access `useGT`, `useLocale`, and `useDefaultLocale`.
|
|
@@ -252,6 +252,19 @@ export declare const useGTClass: typeof _useGTClass;
|
|
|
252
252
|
* console.log(localeProperties);
|
|
253
253
|
*/
|
|
254
254
|
export declare const useLocaleProperties: typeof _useLocaleProperties;
|
|
255
|
+
/**
|
|
256
|
+
* Retrieves the text direction ('ltr' or 'rtl') for the current or specified locale from the `<GTProvider>` context.
|
|
257
|
+
*
|
|
258
|
+
* If no locale is provided, the direction for the current user's locale is returned.
|
|
259
|
+
*
|
|
260
|
+
* @param {string} [locale] - Optional locale code (e.g., 'ar', 'en-US'). If omitted, uses the current locale from context.
|
|
261
|
+
* @returns {'ltr' | 'rtl'} The text direction for the locale: 'rtl' for right-to-left languages, otherwise 'ltr'.
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* const dir = useLocaleDirection(); // e.g., 'ltr'
|
|
265
|
+
* const arabicDir = useLocaleDirection('ar'); // 'rtl'
|
|
266
|
+
*/
|
|
267
|
+
export declare const useLocaleDirection: typeof _useLocaleDirection;
|
|
255
268
|
/**
|
|
256
269
|
* A dropdown component that allows users to select a region.
|
|
257
270
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.types.d.ts","sourceRoot":"","sources":["../src/index.types.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAC1C,OAAO,EACL,KAAK,IAAI,MAAM,EACf,eAAe,IAAI,gBAAgB,EACnC,SAAS,IAAI,UAAU,EACvB,UAAU,IAAI,WAAW,EACzB,gBAAgB,IAAI,iBAAiB,EACrC,UAAU,IAAI,WAAW,EACzB,mBAAmB,IAAI,oBAAoB,EAC3C,QAAQ,IAAI,SAAS,EACrB,QAAQ,IAAI,SAAS,EACrB,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,MAAM,IAAI,OAAO,EACjB,MAAM,IAAI,OAAO,EACjB,cAAc,IAAI,eAAe,EACjC,cAAc,IAAI,eAAe,
|
|
1
|
+
{"version":3,"file":"index.types.d.ts","sourceRoot":"","sources":["../src/index.types.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,uBAAuB,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AACH,eAAO,MAAM,cAAc,EAAE,OAAO,eAEnC,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,KAAK,EAAE,OAAO,MAE1B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,EAAE,OAAO,gBAEpC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,EAAE,OAAO,UAE9B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,EAAE,OAAO,WAE/B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,EAAE,OAAO,iBAErC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,EAAE,OAAO,WAE/B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,OAAO,oBAExC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAAO,mBAEvC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,cAAc,EAAE,OAAO,eAEnC,CAAC;AAEF,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,GAC1B,CAAC"}
|
package/dist/index.types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RegionSelector = exports.useLocaleProperties = exports.useGTClass = exports.useDefaultLocale = exports.useLocales = exports.useLocale = exports.useTranslations = exports.useGT = exports.LocaleSelector = exports.Plural = exports.Branch = exports.Var = exports.Num = exports.DateTime = exports.Currency = exports.T = exports.GTProvider = void 0;
|
|
3
|
+
exports.RegionSelector = exports.useLocaleDirection = exports.useLocaleProperties = exports.useGTClass = exports.useDefaultLocale = exports.useLocales = exports.useLocale = exports.useTranslations = exports.useGT = exports.LocaleSelector = exports.Plural = exports.Branch = exports.Var = exports.Num = exports.DateTime = exports.Currency = exports.T = exports.GTProvider = void 0;
|
|
4
4
|
var createErrors_1 = require("./errors/createErrors");
|
|
5
5
|
/**
|
|
6
6
|
* Provides General Translation context to its children, which can then access `useGT`, `useLocale`, and `useDefaultLocale`.
|
|
@@ -314,6 +314,22 @@ var useLocaleProperties = function () {
|
|
|
314
314
|
throw new Error(createErrors_1.typesFileError);
|
|
315
315
|
};
|
|
316
316
|
exports.useLocaleProperties = useLocaleProperties;
|
|
317
|
+
/**
|
|
318
|
+
* Retrieves the text direction ('ltr' or 'rtl') for the current or specified locale from the `<GTProvider>` context.
|
|
319
|
+
*
|
|
320
|
+
* If no locale is provided, the direction for the current user's locale is returned.
|
|
321
|
+
*
|
|
322
|
+
* @param {string} [locale] - Optional locale code (e.g., 'ar', 'en-US'). If omitted, uses the current locale from context.
|
|
323
|
+
* @returns {'ltr' | 'rtl'} The text direction for the locale: 'rtl' for right-to-left languages, otherwise 'ltr'.
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* const dir = useLocaleDirection(); // e.g., 'ltr'
|
|
327
|
+
* const arabicDir = useLocaleDirection('ar'); // 'rtl'
|
|
328
|
+
*/
|
|
329
|
+
var useLocaleDirection = function () {
|
|
330
|
+
throw new Error(createErrors_1.typesFileError);
|
|
331
|
+
};
|
|
332
|
+
exports.useLocaleDirection = useLocaleDirection;
|
|
317
333
|
/**
|
|
318
334
|
* A dropdown component that allows users to select a region.
|
|
319
335
|
*
|
package/dist/index.types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.types.js","sourceRoot":"","sources":["../src/index.types.ts"],"names":[],"mappings":";;;AAAA,sDAAuD;
|
|
1
|
+
{"version":3,"file":"index.types.js","sourceRoot":"","sources":["../src/index.types.ts"],"names":[],"mappings":";;;AAAA,sDAAuD;AA2BvD;;;;;;;;GAQG;AACI,IAAM,UAAU,GAAuB;IAC5C,MAAM,IAAI,KAAK,CAAC,6BAAc,CAAC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AC;AAClC,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAEF;;;;;;;;;GASG;AACI,IAAM,mBAAmB,GAAgC;IAC9D,MAAM,IAAI,KAAK,CAAC,6BAAc,CAAC,CAAC;AAClC,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B;AAEF;;;;;;;;;;;GAWG;AACI,IAAM,kBAAkB,GAA+B;IAC5D,MAAM,IAAI,KAAK,CAAC,6BAAc,CAAC,CAAC;AAClC,CAAC,CAAC;AAFW,QAAA,kBAAkB,sBAE7B;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,IAAM,cAAc,GAA2B;IACpD,MAAM,IAAI,KAAK,CAAC,6BAAc,CAAC,CAAC;AAClC,CAAC,CAAC;AAFW,QAAA,cAAc,kBAEzB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves the text direction ('ltr' or 'rtl') for the current or specified locale.
|
|
3
|
+
*
|
|
4
|
+
* If no locale is provided, the direction for the current user's locale is returned.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} [locale] - Optional locale code (e.g., 'ar', 'en-US'). If omitted, uses the current locale.
|
|
7
|
+
* @returns {Promise<'ltr' | 'rtl'>} A promise that resolves to the text direction for the locale: 'rtl' for right-to-left languages, otherwise 'ltr'.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const dir = await getLocaleDirection(); // e.g., 'ltr'
|
|
11
|
+
* const arabicDir = await getLocaleDirection('ar'); // 'rtl'
|
|
12
|
+
*/
|
|
13
|
+
export declare function getLocaleDirection(locale?: string): Promise<'ltr' | 'rtl'>;
|
|
14
|
+
/**
|
|
15
|
+
* Retrieves the text direction ('ltr' or 'rtl') for the current or specified locale from the `<GTProvider>` context.
|
|
16
|
+
*
|
|
17
|
+
* If no locale is provided, the direction for the current user's locale is returned.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} [locale] - Optional locale code (e.g., 'ar', 'en-US'). If omitted, uses the current locale from context.
|
|
20
|
+
* @returns {'ltr' | 'rtl'} The text direction for the locale: 'rtl' for right-to-left languages, otherwise 'ltr'.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const dir = useLocaleDirection(); // e.g., 'ltr'
|
|
24
|
+
* const arabicDir = useLocaleDirection('ar'); // 'rtl'
|
|
25
|
+
*/
|
|
26
|
+
export declare function useLocaleDirection(locale?: string): 'ltr' | 'rtl';
|
|
27
|
+
//# sourceMappingURL=getLocaleDirection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLocaleDirection.d.ts","sourceRoot":"","sources":["../../src/request/getLocaleDirection.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,CAIxB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAEjE"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
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);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.getLocaleDirection = getLocaleDirection;
|
|
43
|
+
exports.useLocaleDirection = useLocaleDirection;
|
|
44
|
+
var getI18NConfig_1 = __importDefault(require("../config-dir/getI18NConfig"));
|
|
45
|
+
var use_1 = __importDefault(require("../utils/use"));
|
|
46
|
+
var getLocale_1 = require("./getLocale");
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves the text direction ('ltr' or 'rtl') for the current or specified locale.
|
|
49
|
+
*
|
|
50
|
+
* If no locale is provided, the direction for the current user's locale is returned.
|
|
51
|
+
*
|
|
52
|
+
* @param {string} [locale] - Optional locale code (e.g., 'ar', 'en-US'). If omitted, uses the current locale.
|
|
53
|
+
* @returns {Promise<'ltr' | 'rtl'>} A promise that resolves to the text direction for the locale: 'rtl' for right-to-left languages, otherwise 'ltr'.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* const dir = await getLocaleDirection(); // e.g., 'ltr'
|
|
57
|
+
* const arabicDir = await getLocaleDirection('ar'); // 'rtl'
|
|
58
|
+
*/
|
|
59
|
+
function getLocaleDirection(locale) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
61
|
+
var _a, gt;
|
|
62
|
+
return __generator(this, function (_b) {
|
|
63
|
+
switch (_b.label) {
|
|
64
|
+
case 0:
|
|
65
|
+
_a = locale;
|
|
66
|
+
if (_a) return [3 /*break*/, 2];
|
|
67
|
+
return [4 /*yield*/, (0, getLocale_1.getLocale)()];
|
|
68
|
+
case 1:
|
|
69
|
+
_a = (locale = _b.sent());
|
|
70
|
+
_b.label = 2;
|
|
71
|
+
case 2:
|
|
72
|
+
_a;
|
|
73
|
+
gt = (0, getI18NConfig_1.default)().getGTClass();
|
|
74
|
+
return [2 /*return*/, gt.getLocaleDirection(locale)];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Retrieves the text direction ('ltr' or 'rtl') for the current or specified locale from the `<GTProvider>` context.
|
|
81
|
+
*
|
|
82
|
+
* If no locale is provided, the direction for the current user's locale is returned.
|
|
83
|
+
*
|
|
84
|
+
* @param {string} [locale] - Optional locale code (e.g., 'ar', 'en-US'). If omitted, uses the current locale from context.
|
|
85
|
+
* @returns {'ltr' | 'rtl'} The text direction for the locale: 'rtl' for right-to-left languages, otherwise 'ltr'.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* const dir = useLocaleDirection(); // e.g., 'ltr'
|
|
89
|
+
* const arabicDir = useLocaleDirection('ar'); // 'rtl'
|
|
90
|
+
*/
|
|
91
|
+
function useLocaleDirection(locale) {
|
|
92
|
+
return (0, use_1.default)(getLocaleDirection(locale));
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=getLocaleDirection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLocaleDirection.js","sourceRoot":"","sources":["../../src/request/getLocaleDirection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,gDAMC;AAcD,gDAEC;AAtCD,8EAAwD;AACxD,qDAA+B;AAC/B,yCAAwC;AAExC;;;;;;;;;;;GAWG;AACH,SAAsB,kBAAkB,CACtC,MAAe;;;;;;oBAEf,KAAA,MAAM,CAAA;4BAAN,wBAAM;oBAAK,qBAAM,IAAA,qBAAS,GAAE,EAAA;;0BAA5B,MAAM,GAAK,SAAiB;;;oBAA5B,GAA6B;oBACvB,EAAE,GAAG,IAAA,uBAAa,GAAE,CAAC,UAAU,EAAE,CAAC;oBACxC,sBAAO,EAAE,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAC;;;;CACtC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,kBAAkB,CAAC,MAAe;IAChD,OAAO,IAAA,aAAG,EAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -6,9 +6,10 @@ import GTProvider from './provider/GTProvider';
|
|
|
6
6
|
import Tx from './server-dir/runtime/_Tx';
|
|
7
7
|
import { getGT } from './server-dir/buildtime/getGT';
|
|
8
8
|
import { LocaleProperties } from 'generaltranslation/types';
|
|
9
|
+
import { getLocaleDirection } from './request/getLocaleDirection';
|
|
9
10
|
export declare function getDefaultLocale(): string;
|
|
10
11
|
export declare function getGTClass(): import("generaltranslation").GT;
|
|
11
12
|
export declare function getLocaleProperties(locale: string): LocaleProperties;
|
|
12
13
|
export declare function getLocales(): string[];
|
|
13
|
-
export { GTProvider, T, getGT, tx, Tx, getLocale, getTranslations };
|
|
14
|
+
export { GTProvider, T, getGT, tx, Tx, getLocale, getTranslations, getLocaleDirection, };
|
|
14
15
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,0BAA0B,CAAC;AACzC,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,0BAA0B,CAAC;AACzC,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,UAAU,oCAEzB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAEpE;AAED,wBAAgB,UAAU,IAAI,MAAM,EAAE,CAErC;AAED,OAAO,EACL,UAAU,EACV,CAAC,EACD,KAAK,EACL,EAAE,EACF,EAAE,EACF,SAAS,EACT,eAAe,EACf,kBAAkB,GACnB,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getTranslations = exports.getLocale = exports.Tx = exports.tx = exports.getGT = exports.T = exports.GTProvider = void 0;
|
|
6
|
+
exports.getLocaleDirection = exports.getTranslations = exports.getLocale = exports.Tx = exports.tx = exports.getGT = exports.T = exports.GTProvider = void 0;
|
|
7
7
|
exports.getDefaultLocale = getDefaultLocale;
|
|
8
8
|
exports.getGTClass = getGTClass;
|
|
9
9
|
exports.getLocaleProperties = getLocaleProperties;
|
|
@@ -23,6 +23,8 @@ var _Tx_1 = __importDefault(require("./server-dir/runtime/_Tx"));
|
|
|
23
23
|
exports.Tx = _Tx_1.default;
|
|
24
24
|
var getGT_1 = require("./server-dir/buildtime/getGT");
|
|
25
25
|
Object.defineProperty(exports, "getGT", { enumerable: true, get: function () { return getGT_1.getGT; } });
|
|
26
|
+
var getLocaleDirection_1 = require("./request/getLocaleDirection");
|
|
27
|
+
Object.defineProperty(exports, "getLocaleDirection", { enumerable: true, get: function () { return getLocaleDirection_1.getLocaleDirection; } });
|
|
26
28
|
function getDefaultLocale() {
|
|
27
29
|
return (0, getI18NConfig_1.default)().getDefaultLocale();
|
|
28
30
|
}
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;AAWA,4CAEC;AAED,gCAEC;AAED,kDAEC;AAED,gCAEC;AAzBD,+DAAyC;AA6BvC,YA7BK,WAAC,CA6BL;AA5BH,+DAAyC;AA8BvC,aA9BK,YAAE,CA8BL;AA7BJ,iDAAgD;AA+B9C,0FA/BO,qBAAS,OA+BP;AA9BX,6EAAuD;AACvD,0EAAyE;AA8BvE,gGA9BO,iCAAe,OA8BP;AA7BjB,qEAA+C;AAuB7C,qBAvBK,oBAAU,CAuBL;AAtBZ,iEAA0C;AA0BxC,aA1BK,aAAE,CA0BL;AAzBJ,sDAAqD;AAuBnD,sFAvBO,aAAK,OAuBP;AArBP,mEAAkE;AA0BhE,mGA1BO,uCAAkB,OA0BP;AAxBpB,SAAgB,gBAAgB;IAC9B,OAAO,IAAA,uBAAa,GAAE,CAAC,gBAAgB,EAAE,CAAC;AAC5C,CAAC;AAED,SAAgB,UAAU;IACxB,OAAO,IAAA,uBAAa,GAAE,CAAC,UAAU,EAAE,CAAC;AACtC,CAAC;AAED,SAAgB,mBAAmB,CAAC,MAAc;IAChD,OAAO,UAAU,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAClD,CAAC;AAED,SAAgB,UAAU;IACxB,OAAO,IAAA,uBAAa,GAAE,CAAC,UAAU,EAAE,CAAC;AACtC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gt-next",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.2",
|
|
4
4
|
"description": "A Next.js library for automatic internationalization.",
|
|
5
5
|
"main": "dist/index.server.js",
|
|
6
6
|
"peerDependencies": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@generaltranslation/supported-locales": "^2.0.13",
|
|
17
17
|
"generaltranslation": "^7.2.0",
|
|
18
|
-
"gt-react": "^10.
|
|
18
|
+
"gt-react": "^10.2.1"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
21
|
"patch": "npm version patch",
|