@botfabrik/engine-webclient 4.106.1 → 4.108.0

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,2 +0,0 @@
1
- declare const getSupportedClientLocale: (userLocale: string) => string;
2
- export default getSupportedClientLocale;
@@ -1,16 +0,0 @@
1
- const getSupportedClientLocale = (userLocale) => {
2
- // Prüfe, ob der Webclient für diese Sprache eine Übersetzung hat
3
- const supportedLocales = ['de', 'en', 'fr', 'it'];
4
- if (supportedLocales.indexOf(userLocale) > -1) {
5
- return userLocale;
6
- }
7
- else {
8
- const detectedLocale = supportedLocales.find((definedLocale) => userLocale.indexOf(definedLocale) === 0);
9
- if (detectedLocale) {
10
- return detectedLocale.toLowerCase();
11
- }
12
- }
13
- // default locale
14
- return 'de';
15
- };
16
- export default getSupportedClientLocale;
@@ -1,18 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import getSupportedClientLocale from './getSupportedClientLocale.js';
3
- describe('get client locale', () => {
4
- it('should return supported client language', () => {
5
- expect(getSupportedClientLocale('de')).toBe('de');
6
- expect(getSupportedClientLocale('de-ch')).toBe('de');
7
- expect(getSupportedClientLocale('en')).toBe('en');
8
- expect(getSupportedClientLocale('en-us')).toBe('en');
9
- expect(getSupportedClientLocale('fr')).toBe('fr');
10
- expect(getSupportedClientLocale('fr-ch')).toBe('fr');
11
- expect(getSupportedClientLocale('it')).toBe('it');
12
- });
13
- it('should return "de" as default locale', () => {
14
- expect(getSupportedClientLocale('ru')).toBe('de');
15
- expect(getSupportedClientLocale('ru-de')).toBe('de');
16
- expect(getSupportedClientLocale('sp')).toBe('de');
17
- });
18
- });