feat(i18n): support for i18n in .ts files (#683)
(cherry picked from commit 732313bfc32a514ef064ca0f90304ff05e2e7ef3)
This commit is contained in:
		
							parent
							
								
									84a4a646f6
								
							
						
					
					
						commit
						ebb4ec4165
					
				| @ -29,3 +29,9 @@ export const i18nPlugin: Plugin = { | |||||||
|     app.use(i18n); |     app.use(i18n); | ||||||
|   }, |   }, | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | export const translate = function (localeKey: string) { | ||||||
|  |   // @ts-expect-error global
 | ||||||
|  |   const hasKey = i18n.global.te(localeKey, i18n.global.locale); | ||||||
|  |   return hasKey ? i18n.global.t(localeKey) : localeKey; | ||||||
|  | }; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user