diff options
author | Chocobozzz <me@florianbigard.com> | 2022-07-15 15:30:14 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-07-18 11:37:18 +0200 |
commit | 42b40636991b97fe818007fab19091764fc5db73 (patch) | |
tree | db431787c06ce898d22e91ff771f795219274fc6 /client/src/app/helpers/i18n-utils.ts | |
parent | 654d4ede7fa4d0faa71e49bcfab6b65a686397b2 (diff) | |
download | PeerTube-42b40636991b97fe818007fab19091764fc5db73.tar.gz PeerTube-42b40636991b97fe818007fab19091764fc5db73.tar.zst PeerTube-42b40636991b97fe818007fab19091764fc5db73.zip |
Add ability for client to create server logs
Diffstat (limited to 'client/src/app/helpers/i18n-utils.ts')
-rw-r--r-- | client/src/app/helpers/i18n-utils.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/client/src/app/helpers/i18n-utils.ts b/client/src/app/helpers/i18n-utils.ts index 2017a31ea..b7d73d16b 100644 --- a/client/src/app/helpers/i18n-utils.ts +++ b/client/src/app/helpers/i18n-utils.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { environment } from '../../environments/environment' | ||
2 | import IntlMessageFormat from 'intl-messageformat' | 1 | import IntlMessageFormat from 'intl-messageformat' |
2 | import { logger } from '@root-helpers/logger' | ||
3 | import { environment } from '../../environments/environment' | ||
3 | 4 | ||
4 | function isOnDevLocale () { | 5 | function isOnDevLocale () { |
5 | return environment.production === false && window.location.search === '?lang=fr' | 6 | return environment.production === false && window.location.search === '?lang=fr' |
@@ -19,14 +20,14 @@ function prepareIcu (icu: string) { | |||
19 | try { | 20 | try { |
20 | return msg.format(context) as string | 21 | return msg.format(context) as string |
21 | } catch (err) { | 22 | } catch (err) { |
22 | if (!alreadyWarned) console.warn('Cannot format ICU %s.', icu, err) | 23 | if (!alreadyWarned) logger.warn(`Cannot format ICU ${icu}.`, err) |
23 | 24 | ||
24 | alreadyWarned = true | 25 | alreadyWarned = true |
25 | return fallback | 26 | return fallback |
26 | } | 27 | } |
27 | } | 28 | } |
28 | } catch (err) { | 29 | } catch (err) { |
29 | console.warn('Cannot build intl message %s.', icu, err) | 30 | logger.warn(`Cannot build intl message ${icu}.`, err) |
30 | 31 | ||
31 | return (_context: unknown, fallback: string) => fallback | 32 | return (_context: unknown, fallback: string) => fallback |
32 | } | 33 | } |