mirror of
https://github.com/jellyfin/jellyfin-vue.git
synced 2024-11-23 05:59:55 +00:00
refactor: reuse capitalize from @vue/shared
Signed-off-by: Fernando Fernández <ferferga@hotmail.com>
This commit is contained in:
parent
68d127f9bc
commit
82a958c59d
@ -33,7 +33,7 @@ import IMdiSurroundSound71 from 'virtual:icons/mdi/surround-sound-7-1';
|
||||
import IMdiSurroundSound from 'virtual:icons/mdi/surround-sound';
|
||||
import { watchImmediate } from '@vueuse/core';
|
||||
import { getLocaleName } from '@/utils/i18n';
|
||||
import { upperFirst } from '@/utils/data-manipulation';
|
||||
import { capitalize } from '@vue/shared';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@ -90,7 +90,7 @@ function getTrackIcon(
|
||||
*/
|
||||
function getTrackSubtitle(track: MediaStream): string | undefined {
|
||||
if ((props.type === 'Audio' || props.type === 'Subtitle') && track.Language) {
|
||||
return upperFirst(
|
||||
return capitalize(
|
||||
getLocaleName(track.Language, locale.value)
|
||||
?? `${t('unknown')} (${track.Language})`
|
||||
);
|
||||
|
@ -24,10 +24,3 @@ export function mergeExcludingUnknown<T extends object, K extends keyof T>(
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uppercase the first letter of a string
|
||||
*/
|
||||
export function upperFirst<T extends string>(str: T): Capitalize<T> {
|
||||
return (str[0].toUpperCase() + str.slice(1)) as Capitalize<T>;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { upperFirst } from '@/utils/data-manipulation';
|
||||
import { capitalize } from '@vue/shared';
|
||||
import { isStr } from '@/utils/validation';
|
||||
|
||||
/**
|
||||
@ -10,7 +10,7 @@ export function getLocaleName(
|
||||
): string | undefined {
|
||||
const r = new Intl.DisplayNames([toCode], { type: 'language' }).of(fromCode);
|
||||
|
||||
return isStr(r) ? upperFirst(r) : r;
|
||||
return isStr(r) ? capitalize(r) : r;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user