valtech-components 2.0.715 → 2.0.717
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/esm2022/lib/services/i18n/default-content.mjs +9 -1
- package/esm2022/lib/services/i18n/i18n.service.mjs +24 -3
- package/esm2022/lib/services/icons.service.mjs +3 -2
- package/esm2022/lib/shared/utils/datetime.mjs +24 -0
- package/esm2022/lib/version.mjs +2 -2
- package/esm2022/public-api.mjs +2 -1
- package/fesm2022/valtech-components.mjs +58 -5
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/services/i18n/i18n.service.d.ts +16 -0
- package/lib/shared/utils/datetime.d.ts +21 -0
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -45,6 +45,22 @@ export declare class I18nService {
|
|
|
45
45
|
* i18n.t('welcome', 'Login', {name}); // con interpolación
|
|
46
46
|
*/
|
|
47
47
|
t(key: string, namespace?: string, data?: Record<string, string>): string;
|
|
48
|
+
/**
|
|
49
|
+
* Returns a time-of-day greeting in the current language.
|
|
50
|
+
*
|
|
51
|
+
* Uses bundled keys `goodMorning` / `goodAfternoon` / `goodEvening` from `_global`.
|
|
52
|
+
* Reactive to `lang()` when called inside a `computed()`.
|
|
53
|
+
*
|
|
54
|
+
* @param name Optional name to append: "Buenos días, Juan"
|
|
55
|
+
* @param date Optional date to evaluate (defaults to now)
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* greeting = computed(() => {
|
|
59
|
+
* this.i18n.lang();
|
|
60
|
+
* return this.i18n.greeting(this.auth.user()?.name);
|
|
61
|
+
* });
|
|
62
|
+
*/
|
|
63
|
+
greeting(name?: string, date?: Date): string;
|
|
48
64
|
/**
|
|
49
65
|
* Obtiene texto traducido
|
|
50
66
|
*
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time-of-day greeting key.
|
|
3
|
+
* Maps to bundled i18n keys in `_global` namespace: goodMorning / goodAfternoon / goodEvening.
|
|
4
|
+
*/
|
|
5
|
+
export type TimeOfDayKey = 'goodMorning' | 'goodAfternoon' | 'goodEvening';
|
|
6
|
+
/**
|
|
7
|
+
* Returns the i18n key for a time-of-day greeting based on the given date's hour.
|
|
8
|
+
*
|
|
9
|
+
* - 00:00 - 11:59 → 'goodMorning'
|
|
10
|
+
* - 12:00 - 17:59 → 'goodAfternoon'
|
|
11
|
+
* - 18:00 - 23:59 → 'goodEvening'
|
|
12
|
+
*
|
|
13
|
+
* Pure function (testable). Defaults to current local time.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* import { getTimeOfDayKey } from 'valtech-components';
|
|
17
|
+
*
|
|
18
|
+
* const key = getTimeOfDayKey(); // 'goodMorning' | 'goodAfternoon' | 'goodEvening'
|
|
19
|
+
* const text = i18n.t(key); // 'Buenos días' | 'Buenas tardes' | 'Buenas noches'
|
|
20
|
+
*/
|
|
21
|
+
export declare function getTimeOfDayKey(date?: Date): TimeOfDayKey;
|
package/lib/version.d.ts
CHANGED
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -281,6 +281,7 @@ export * from './lib/components/templates/docs-shell/types';
|
|
|
281
281
|
export * from './lib/services/docs/docs-navigation.service';
|
|
282
282
|
export * from './lib/components/types';
|
|
283
283
|
export * from './lib/shared/pipes/process-links.pipe';
|
|
284
|
+
export * from './lib/shared/utils/datetime';
|
|
284
285
|
export * from './lib/shared/utils/dom';
|
|
285
286
|
export * from './lib/shared/utils/form-defaults';
|
|
286
287
|
export * from './lib/shared/utils/styles';
|