aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-04-23 14:39:52 +0200
committerChocobozzz <me@florianbigard.com>2018-04-23 14:39:52 +0200
commit9d3ef9fe052ed29bd67566754cb28662bd122234 (patch)
tree7b704dbc0b2c8b4ca18bef2409d640d0019c3d0a /server/models/video
parent2a2c19dfef7a9aa313c6ca0798f271c9a63449a9 (diff)
downloadPeerTube-9d3ef9fe052ed29bd67566754cb28662bd122234.tar.gz
PeerTube-9d3ef9fe052ed29bd67566754cb28662bd122234.tar.zst
PeerTube-9d3ef9fe052ed29bd67566754cb28662bd122234.zip
Use ISO 639 for languages
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/video.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index aef75d206..b0fff6526 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -322,8 +322,8 @@ export class VideoModel extends Model<VideoModel> {
322 @AllowNull(true) 322 @AllowNull(true)
323 @Default(null) 323 @Default(null)
324 @Is('VideoLanguage', value => throwIfNotValid(value, isVideoLanguageValid, 'language')) 324 @Is('VideoLanguage', value => throwIfNotValid(value, isVideoLanguageValid, 'language'))
325 @Column 325 @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.LANGUAGE.max))
326 language: number 326 language: string
327 327
328 @AllowNull(false) 328 @AllowNull(false)
329 @Is('VideoPrivacy', value => throwIfNotValid(value, isVideoPrivacyValid, 'privacy')) 329 @Is('VideoPrivacy', value => throwIfNotValid(value, isVideoPrivacyValid, 'privacy'))
@@ -877,8 +877,10 @@ export class VideoModel extends Model<VideoModel> {
877 return licenceLabel 877 return licenceLabel
878 } 878 }
879 879
880 private static getLanguageLabel (id: number) { 880 private static getLanguageLabel (id: string) {
881 let languageLabel = VIDEO_LANGUAGES[id] 881 let languageLabel = VIDEO_LANGUAGES[id]
882 console.log(VIDEO_LANGUAGES)
883 console.log(id)
882 if (!languageLabel) languageLabel = 'Unknown' 884 if (!languageLabel) languageLabel = 'Unknown'
883 885
884 return languageLabel 886 return languageLabel
@@ -1083,7 +1085,7 @@ export class VideoModel extends Model<VideoModel> {
1083 let language 1085 let language
1084 if (this.language) { 1086 if (this.language) {
1085 language = { 1087 language = {
1086 identifier: this.language + '', 1088 identifier: this.language,
1087 name: VideoModel.getLanguageLabel(this.language) 1089 name: VideoModel.getLanguageLabel(this.language)
1088 } 1090 }
1089 } 1091 }