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
|
||||
},
|
||||
|
||||
currentLocale: function () {
|
||||
return this.$store.getters.getCurrentLocale
|
||||
},
|
||||
|
||||
profileList: function () {
|
||||
return this.$store.getters.getProfileList
|
||||
},
|
||||
|
@ -227,9 +231,9 @@ export default Vue.extend({
|
|||
|
||||
dateString() {
|
||||
const date = new Date(this.published)
|
||||
const dateSplit = date.toDateString().split(' ')
|
||||
const localeDateString = `Video.Published.${dateSplit[1]}`
|
||||
return `${this.$t(localeDateString)} ${dateSplit[2]}, ${dateSplit[3]}`
|
||||
const locale = this.currentLocale.replace('_', '-')
|
||||
const localeDateString = new Intl.DateTimeFormat([locale, 'en'], { dateStyle: 'medium' }).format(date)
|
||||
return `${localeDateString}`
|
||||
},
|
||||
|
||||
publishedString() {
|
||||
|
|
|
@ -288,7 +288,9 @@ const actions = {
|
|||
break
|
||||
}
|
||||
}
|
||||
const locale = settings.currentLocale.replace('-', '_')
|
||||
ytpl(playlistId, {
|
||||
hl: locale,
|
||||
limit: 'Infinity',
|
||||
requestOptions: { agent }
|
||||
}).then((result) => {
|
||||
|
|
Loading…
Reference in New Issue