aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-06 17:37:13 +0200
committerChocobozzz <me@florianbigard.com>2018-06-06 17:37:13 +0200
commit74b7c6d48e9ca377fe938c8134ed74b612e62ba0 (patch)
treecb848dec054a71669fef5ea3986bdd0d2c354248 /client/src/app/shared
parent7ce44a74a3b052190cfacd4bd5ee6b92cfc620ac (diff)
downloadPeerTube-74b7c6d48e9ca377fe938c8134ed74b612e62ba0.tar.gz
PeerTube-74b7c6d48e9ca377fe938c8134ed74b612e62ba0.tar.zst
PeerTube-74b7c6d48e9ca377fe938c8134ed74b612e62ba0.zip
Little i18n refractoring
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/i18n/i18n-utils.ts12
-rw-r--r--client/src/app/shared/video/video.service.ts4
2 files changed, 14 insertions, 2 deletions
diff --git a/client/src/app/shared/i18n/i18n-utils.ts b/client/src/app/shared/i18n/i18n-utils.ts
index c1de51b7b..37180b930 100644
--- a/client/src/app/shared/i18n/i18n-utils.ts
+++ b/client/src/app/shared/i18n/i18n-utils.ts
@@ -1,7 +1,19 @@
1import { environment } from '../../../environments/environment'
2
1function peertubeTranslate (str: string, translations: { [ id: string ]: string }) { 3function peertubeTranslate (str: string, translations: { [ id: string ]: string }) {
2 return translations[str] ? translations[str] : str 4 return translations[str] ? translations[str] : str
3} 5}
4 6
7function isOnDevLocale () {
8 return environment.production === false && window.location.search === '?lang=fr'
9}
10
11function getDevLocale () {
12 return 'fr'
13}
14
5export { 15export {
16 getDevLocale,
17 isOnDevLocale,
6 peertubeTranslate 18 peertubeTranslate
7} 19}
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index c607b7d6a..58cb52efc 100644
--- a/client/src/app/shared/video/video.service.ts
+++ b/client/src/app/shared/video/video.service.ts
@@ -46,8 +46,8 @@ export class VideoService {
46 return this.serverService.localeObservable 46 return this.serverService.localeObservable
47 .pipe( 47 .pipe(
48 switchMap(translations => { 48 switchMap(translations => {
49 return this.authHttp.get<VideoDetailsServerModel>(VideoService.BASE_VIDEO_URL + uuid) 49 return this.authHttp.get<VideoDetailsServerModel>(VideoService.BASE_VIDEO_URL + uuid)
50 .pipe(map(videoHash => ({ videoHash, translations }))) 50 .pipe(map(videoHash => ({ videoHash, translations })))
51 }), 51 }),
52 map(({ videoHash, translations }) => new VideoDetails(videoHash, translations)), 52 map(({ videoHash, translations }) => new VideoDetails(videoHash, translations)),
53 catchError(res => this.restExtractor.handleError(res)) 53 catchError(res => this.restExtractor.handleError(res))