feat(i18n): i18n Outlook safelink tool
refactor(tools): Only show the output when there is an input value
This commit is contained in:
		
							parent
							
								
									5f5e01d594
								
							
						
					
					
						commit
						61b5a610ea
					
				
							
								
								
									
										1
									
								
								components.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								components.d.ts
									
									
									
									
										vendored
									
									
								
							| @ -160,6 +160,7 @@ declare module '@vue/runtime-core' { | ||||
|     RouterLink: typeof import('vue-router')['RouterLink'] | ||||
|     RouterView: typeof import('vue-router')['RouterView'] | ||||
|     RsaKeyPairGenerator: typeof import('./src/tools/rsa-key-pair-generator/rsa-key-pair-generator.vue')['default'] | ||||
|     SafelinkDecoder: typeof import('./src/tools/safelink-decoder/safelink-decoder.vue')['default'] | ||||
|     SlugifyString: typeof import('./src/tools/slugify-string/slugify-string.vue')['default'] | ||||
|     SpanCopyable: typeof import('./src/components/SpanCopyable.vue')['default'] | ||||
|     SqlPrettify: typeof import('./src/tools/sql-prettify/sql-prettify.vue')['default'] | ||||
|  | ||||
| @ -44,13 +44,6 @@ | ||||
|     /> | ||||
|     <meta name="twitter:image" content="https://it-tools.tech/banner.png?v=2" /> | ||||
|     <meta name="twitter:image:alt" content="IT Tools - Handy online tools for developers" /> | ||||
|     <script type="text/javascript"> | ||||
|       (function (c, l, a, r, i, t, y) { | ||||
|         c[a] = c[a] || function () { (c[a].q = c[a].q || []).push(arguments); }; | ||||
|         t = l.createElement(r); t.async = 1; t.src = `https://www.clarity.ms/tag/${i}`; | ||||
|         y = l.getElementsByTagName(r)[0]; y.parentNode.insertBefore(t, y); | ||||
|       })(window, document, 'clarity', 'script', 'l588ndu5jj'); | ||||
|     </script> | ||||
|   </head> | ||||
|   <body> | ||||
|     <div id="app"></div> | ||||
|  | ||||
| @ -1,10 +1,11 @@ | ||||
| import { Mailbox } from '@vicons/tabler'; | ||||
| import { defineTool } from '../tool'; | ||||
| import { translate as t } from '@/plugins/i18n.plugin'; | ||||
| 
 | ||||
| export const tool = defineTool({ | ||||
|   name: 'Outlook Safelink decoder', | ||||
|   name: t('tools.safelink-decoder.title'), | ||||
|   path: '/safelink-decoder', | ||||
|   description: 'Decode Outlook SafeLink links', | ||||
|   description: t('tools.safelink-decoder.description'), | ||||
|   keywords: ['outlook', 'safelink', 'decoder'], | ||||
|   component: () => import('./safelink-decoder.vue'), | ||||
|   icon: Mailbox, | ||||
|  | ||||
							
								
								
									
										10
									
								
								src/tools/safelink-decoder/locales/en.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/tools/safelink-decoder/locales/en.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,10 @@ | ||||
| tools: | ||||
|   safelink-decoder: | ||||
|     title: Outlook Safelink decoder | ||||
|     description: Decode Outlook SafeLink links | ||||
| 
 | ||||
|     inputLabel: 'Your input Outlook SafeLink Url:' | ||||
|     inputPlaceholder: Your input Outlook SafeLink Url... | ||||
|     outputLabel: 'Output decoded URL:' | ||||
| 
 | ||||
|     invalidMessage: Invalid SafeLinks URL provided | ||||
							
								
								
									
										10
									
								
								src/tools/safelink-decoder/locales/zh.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/tools/safelink-decoder/locales/zh.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,10 @@ | ||||
| tools: | ||||
|   safelink-decoder: | ||||
|     title: Outlook 安全链接解码器 | ||||
|     description: 解码 Outlook 安全链接 | ||||
| 
 | ||||
|     inputLabel: '您的输入 Outlook 安全链接:' | ||||
|     inputPlaceholder: 您的输入 Outlook 安全链接... | ||||
|     outputLabel: '解码后的 URL:' | ||||
| 
 | ||||
|     invalidMessage: 提供的安全链接无效 | ||||
| @ -1,6 +1,8 @@ | ||||
| import { translate as t } from '@/plugins/i18n.plugin'; | ||||
| 
 | ||||
| export function decodeSafeLinksURL(safeLinksUrl: string) { | ||||
|   if (!safeLinksUrl.match(/\.safelinks\.protection\.outlook\.com/)) { | ||||
|     throw new Error('Invalid SafeLinks URL provided'); | ||||
|     throw new Error(t('tools.safelink-decoder.invalidMessage')); | ||||
|   } | ||||
| 
 | ||||
|   return new URL(safeLinksUrl).searchParams.get('url'); | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| import { decodeSafeLinksURL } from './safelink-decoder.service'; | ||||
| import TextareaCopyable from '@/components/TextareaCopyable.vue'; | ||||
| 
 | ||||
| const { t } = useI18n(); | ||||
| const inputSafeLinkUrl = ref(''); | ||||
| const outputDecodedUrl = computed(() => { | ||||
|   try { | ||||
| @ -18,14 +19,14 @@ const outputDecodedUrl = computed(() => { | ||||
|     <c-input-text | ||||
|       v-model:value="inputSafeLinkUrl" | ||||
|       raw-text | ||||
|       placeholder="Your input Outlook SafeLink Url..." | ||||
|       :placeholder="t('tools.safelink-decoder.inputPlaceholder')" | ||||
|       autofocus | ||||
|       label="Your input Outlook SafeLink Url:" | ||||
|       :label="t('tools.safelink-decoder.inputLabel')" | ||||
|     /> | ||||
| 
 | ||||
|     <n-divider /> | ||||
| 
 | ||||
|     <n-form-item label="Output decoded URL:"> | ||||
|     <n-form-item v-if="inputSafeLinkUrl !== ''" :label="t('tools.safelink-decoder.outputLabel')"> | ||||
|       <TextareaCopyable :value="outputDecodedUrl" :word-wrap="true" /> | ||||
|     </n-form-item> | ||||
|   </div> | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user