@digitaldefiance/i18n-lib 1.0.22 → 1.0.24

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.
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GlobalActiveContext = void 0;
4
- exports.setUserLanguage = setUserLanguage;
5
- exports.setCurrencyCode = setCurrencyCode;
6
- exports.setAdminLanguage = setAdminLanguage;
7
- exports.setLanguageContext = setLanguageContext;
8
- exports.setSystemContext = setSystemContext;
9
- exports.setApiContext = setApiContext;
10
- exports.setUserTimezone = setUserTimezone;
11
- exports.setAdminTimezone = setAdminTimezone;
12
- const currency_code_1 = require("./interfaces/currency-code");
13
- const shared_types_1 = require("./shared-types");
14
- const i18n_lib_1 = require("@digitaldefiance/i18n-lib");
15
- // Create the base context
16
- const baseContext = {
17
- /**
18
- * The language to use for translations in the user facing ui
19
- */
20
- language: shared_types_1.DefaultLanguage,
21
- /**
22
- * The language to use for console/admin logs
23
- */
24
- adminLanguage: shared_types_1.DefaultLanguage,
25
- currencyCode: new currency_code_1.CurrencyCode(shared_types_1.DefaultCurrencyCode),
26
- /**
27
- * The current default context for language translations
28
- */
29
- currentContext: 'user',
30
- /**
31
- * The timezone for the user facing UI
32
- */
33
- timezone: new i18n_lib_1.Timezone('UTC'),
34
- /**
35
- * The timezone for the admin console
36
- */
37
- adminTimezone: new i18n_lib_1.Timezone('UTC'),
38
- };
39
- // Export the context (can be proxied for change detection)
40
- exports.GlobalActiveContext = baseContext;
41
- function setUserLanguage(language) {
42
- exports.GlobalActiveContext.language = language;
43
- }
44
- function setCurrencyCode(code) {
45
- exports.GlobalActiveContext.currencyCode = code;
46
- }
47
- /**
48
- * Sets the admin language for console operations
49
- * @param language The language to set for admin operations
50
- */
51
- function setAdminLanguage(language) {
52
- exports.GlobalActiveContext.adminLanguage = language;
53
- }
54
- /**
55
- * Sets the language context for the current context
56
- * @param context The language context to set
57
- */
58
- function setLanguageContext(context) {
59
- exports.GlobalActiveContext.currentContext = context;
60
- }
61
- // Helper functions for new contexts
62
- function setSystemContext() {
63
- setLanguageContext('system');
64
- }
65
- function setApiContext() {
66
- setLanguageContext('api');
67
- }
68
- function setUserTimezone(tz) {
69
- exports.GlobalActiveContext.timezone = tz;
70
- }
71
- function setAdminTimezone(tz) {
72
- exports.GlobalActiveContext.adminTimezone = tz;
73
- }