WIP(translate): translate converter category all tools

This commit is contained in:
Amery2010 2023-12-26 23:57:28 +08:00
parent 2ee3b01105
commit 2da11a7242
68 changed files with 716 additions and 174 deletions

View file

@ -1,3 +1,5 @@
import { translate } from '@/plugins/i18n.plugin';
export { convertTextToAsciiBinary, convertAsciiBinaryToText };
function convertTextToAsciiBinary(text: string, { separator = ' ' }: { separator?: string } = {}): string {
@ -11,7 +13,7 @@ function convertAsciiBinaryToText(binary: string): string {
const cleanBinary = binary.replace(/[^01]/g, '');
if (cleanBinary.length % 8) {
throw new Error('Invalid binary string');
throw new Error(translate('tools.text-to-binary.invalidBinaryString'));
}
return cleanBinary