1
0
Fork 0

Rename fr locale -> fr-FR

This commit is contained in:
Chocobozzz 2018-06-06 18:04:33 +02:00
parent 74b7c6d48e
commit 9f16472264
No known key found for this signature in database
GPG key ID: 583A612D890159BE
5 changed files with 2902 additions and 4 deletions

View file

@ -12,7 +12,7 @@ import './peertube-videojs-plugin'
import './peertube-load-progress-bar' import './peertube-load-progress-bar'
import { videojsUntyped } from './peertube-videojs-typings' import { videojsUntyped } from './peertube-videojs-typings'
import { buildVideoEmbed, buildVideoLink, copyToClipboard } from './utils' import { buildVideoEmbed, buildVideoLink, copyToClipboard } from './utils'
import { getCompleteLocale, is18nLocale, isDefaultLocale } from '../../../../shared/models/i18n/i18n' import { getCompleteLocale, getShortLocale, is18nLocale, isDefaultLocale } from '../../../../shared/models/i18n/i18n'
// Change 'Playback Rate' to 'Speed' (smaller for our settings menu) // Change 'Playback Rate' to 'Speed' (smaller for our settings menu)
videojsUntyped.getComponent('PlaybackRateMenuButton').prototype.controlText_ = 'Speed' videojsUntyped.getComponent('PlaybackRateMenuButton').prototype.controlText_ = 'Speed'
@ -147,7 +147,7 @@ function loadLocale (serverUrl: string, videojs: any, locale: string) {
return fetch(serverUrl + '/client/locales/' + completeLocale + '/player.json') return fetch(serverUrl + '/client/locales/' + completeLocale + '/player.json')
.then(res => res.json()) .then(res => res.json())
.then(json => videojs.addLanguage(completeLocale, json)) .then(json => videojs.addLanguage(getShortLocale(completeLocale), json))
} }
export { export {

File diff suppressed because it is too large Load diff

View file

@ -2,11 +2,12 @@ export const LOCALE_FILES = [ 'player', 'server' ]
export const I18N_LOCALES = { export const I18N_LOCALES = {
'en-US': 'English (US)', 'en-US': 'English (US)',
fr: 'French' 'fr-FR': 'French (France)'
} }
const I18N_LOCALE_ALIAS = { const I18N_LOCALE_ALIAS = {
'en': 'en-US' 'en': 'en-US',
'fr': 'fr-FR'
} }
export const POSSIBLE_LOCALES = Object.keys(I18N_LOCALES) export const POSSIBLE_LOCALES = Object.keys(I18N_LOCALES)
@ -38,6 +39,12 @@ export function getCompleteLocale (locale: string) {
return locale return locale
} }
export function getShortLocale (locale: string) {
if (locale.indexOf('-') === -1) return locale
return locale.split('-')[0]
}
export function buildFileLocale (locale: string) { export function buildFileLocale (locale: string) {
const completeLocale = getCompleteLocale(locale) const completeLocale = getCompleteLocale(locale)