File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44export function useViewOnGitProvider (
55 provider : MaybeRefOrGetter < ProviderId | ( string & { } ) | null | undefined > ,
66) {
7- const { t } = useI18n ( )
7+ const { t, te } = useI18n ( )
88 return computed ( ( ) => {
99 const uProvider = toValue ( provider )
10- // using this switch instead of `view_on.${provider}` to prevent missing future translations
11- switch ( uProvider ) {
12- case 'github' :
13- return t ( 'common.view_on.github' )
14- case 'gitlab' :
15- return t ( 'common.view_on.gitlab' )
16- case 'bitbucket' :
17- return t ( 'common.view_on.bitbucket' )
18- case 'codeberg' :
19- return t ( 'common.view_on.codeberg' )
20- case 'forgejo' :
21- return t ( 'common.view_on.forgejo' )
22- case 'gitea' :
23- return t ( 'common.view_on.gitea' )
24- case 'gitee' :
25- return t ( 'common.view_on.gitee' )
26- case 'radicle' :
27- return t ( 'common.view_on.radicle' )
28- case 'sourcehut' :
29- return t ( 'common.view_on.sourcehut' )
30- case 'tangled' :
31- return t ( 'common.view_on.tangled' )
10+ const key = `common.view_on.${ uProvider } `
11+ if ( uProvider && te ( key ) ) {
12+ return t ( key )
3213 }
3314 return t ( 'common.view_on.git_repo' )
3415 } )
You can’t perform that action at this time.
0 commit comments