mirror of
https://github.com/FreeTubeApp/FreeTube
synced 2024-12-11 12:09:35 +01:00
Date locale change (#1757)
* Update watch-video-info.js * Modified language files Modified language files to include the ISO 639-1 language code * Change date based on locale This changes the date based on locale. If locale does not exist it defaults to English * Removed locale codes from files * Getting locale code from $store * Delete launch.json * Replace _ with - for locale * Add locale change to playlist query Change the locale of playlist query. On error defaults to user location (the library does it, no extra work required) Does not work with Norsk nyorsk locale * Make linter happy * Lint * replace dashes with underscores for locale string
This commit is contained in:
parent
8a3515df16
commit
0a12e58796
@ -130,6 +130,10 @@ export default Vue.extend({
|
|||||||
return this.$store.getters.getCurrentInvidiousInstance
|
return this.$store.getters.getCurrentInvidiousInstance
|
||||||
},
|
},
|
||||||
|
|
||||||
|
currentLocale: function () {
|
||||||
|
return this.$store.getters.getCurrentLocale
|
||||||
|
},
|
||||||
|
|
||||||
profileList: function () {
|
profileList: function () {
|
||||||
return this.$store.getters.getProfileList
|
return this.$store.getters.getProfileList
|
||||||
},
|
},
|
||||||
@ -227,9 +231,9 @@ export default Vue.extend({
|
|||||||
|
|
||||||
dateString() {
|
dateString() {
|
||||||
const date = new Date(this.published)
|
const date = new Date(this.published)
|
||||||
const dateSplit = date.toDateString().split(' ')
|
const locale = this.currentLocale.replace('_', '-')
|
||||||
const localeDateString = `Video.Published.${dateSplit[1]}`
|
const localeDateString = new Intl.DateTimeFormat([locale, 'en'], { dateStyle: 'medium' }).format(date)
|
||||||
return `${this.$t(localeDateString)} ${dateSplit[2]}, ${dateSplit[3]}`
|
return `${localeDateString}`
|
||||||
},
|
},
|
||||||
|
|
||||||
publishedString() {
|
publishedString() {
|
||||||
|
@ -288,7 +288,9 @@ const actions = {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const locale = settings.currentLocale.replace('-', '_')
|
||||||
ytpl(playlistId, {
|
ytpl(playlistId, {
|
||||||
|
hl: locale,
|
||||||
limit: 'Infinity',
|
limit: 'Infinity',
|
||||||
requestOptions: { agent }
|
requestOptions: { agent }
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user