| 
									
										
										
										
											2022-03-19 22:27:40 +01:00
										 |  |  | <template> | 
					
						
							| 
									
										
										
										
											2022-03-19 16:33:55 -08:00
										 |  |  |   <BaseDialog v-model="dialog" :icon="$globals.icons.translate" :title="$tc('language-dialog.choose-language')"> | 
					
						
							|  |  |  |     <v-card-text> | 
					
						
							|  |  |  |       {{ $t("language-dialog.select-description") }} | 
					
						
							|  |  |  |       <v-autocomplete | 
					
						
							|  |  |  |         v-model="locale" | 
					
						
							|  |  |  |         :items="locales" | 
					
						
							|  |  |  |         item-text="name" | 
					
						
							|  |  |  |         menu-props="auto" | 
					
						
							|  |  |  |         class="my-3" | 
					
						
							|  |  |  |         hide-details | 
					
						
							|  |  |  |         outlined | 
					
						
							|  |  |  |         offset | 
					
						
							|  |  |  |       > | 
					
						
							|  |  |  |         <template #item="{ item }"> | 
					
						
							|  |  |  |           <v-list-item-content> | 
					
						
							|  |  |  |             <v-list-item-title v-text="item.name"></v-list-item-title> | 
					
						
							|  |  |  |             <v-list-item-subtitle> {{ item.progress }}% {{ $tc("language-dialog.translated") }} </v-list-item-subtitle> | 
					
						
							|  |  |  |           </v-list-item-content> | 
					
						
							|  |  |  |         </template> | 
					
						
							|  |  |  |       </v-autocomplete> | 
					
						
							|  |  |  |       <i18n path="language-dialog.how-to-contribute-description"> | 
					
						
							|  |  |  |         <template #read-the-docs-link> | 
					
						
							|  |  |  |           <a href="https://docs.mealie.io/contributors/translating/" target="_blank">{{ | 
					
						
							|  |  |  |             $t("language-dialog.read-the-docs") | 
					
						
							|  |  |  |           }}</a> | 
					
						
							|  |  |  |         </template> | 
					
						
							|  |  |  |       </i18n> | 
					
						
							|  |  |  |     </v-card-text> | 
					
						
							|  |  |  |   </BaseDialog> | 
					
						
							| 
									
										
										
										
											2022-03-19 22:27:40 +01:00
										 |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2022-03-19 16:33:55 -08:00
										 |  |  | import { computed, defineComponent } from "@nuxtjs/composition-api"; | 
					
						
							| 
									
										
										
										
											2022-03-19 22:27:40 +01:00
										 |  |  | import type { LocaleObject } from "@nuxtjs/i18n"; | 
					
						
							| 
									
										
										
										
											2022-03-19 16:33:55 -08:00
										 |  |  | import { useLocales } from "~/composables/use-locales"; | 
					
						
							| 
									
										
										
										
											2022-03-19 22:27:40 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | export default defineComponent({ | 
					
						
							|  |  |  |   props: { | 
					
						
							|  |  |  |     value: { | 
					
						
							|  |  |  |       type: Boolean, | 
					
						
							| 
									
										
										
										
											2022-03-19 16:33:55 -08:00
										 |  |  |       default: false, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2022-03-19 22:27:40 +01:00
										 |  |  |   }, | 
					
						
							|  |  |  |   setup(props, context) { | 
					
						
							|  |  |  |     const dialog = computed<boolean>({ | 
					
						
							|  |  |  |       get() { | 
					
						
							|  |  |  |         return props.value; | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       set(val) { | 
					
						
							|  |  |  |         context.emit("input", val); | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-19 16:33:55 -08:00
										 |  |  |     const { locales: LOCALES, locale, i18n } = useLocales(); | 
					
						
							| 
									
										
										
										
											2022-03-19 22:27:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-19 16:33:55 -08:00
										 |  |  |     const locales = LOCALES.filter((locale) => | 
					
						
							|  |  |  |       (i18n.locales as LocaleObject[]).map((i18nLocale) => i18nLocale.code).includes(locale.value) | 
					
						
							|  |  |  |     ); | 
					
						
							| 
									
										
										
										
											2022-03-19 22:27:40 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     return { | 
					
						
							|  |  |  |       dialog, | 
					
						
							|  |  |  |       i18n, | 
					
						
							|  |  |  |       locales, | 
					
						
							|  |  |  |       locale, | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2022-03-19 16:33:55 -08:00
										 |  |  |   }, | 
					
						
							| 
									
										
										
										
											2022-03-19 22:27:40 +01:00
										 |  |  | }); | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-19 16:33:55 -08:00
										 |  |  | <style scoped></style> |