feat(i18n): get locales on build (#880)

This commit is contained in:
Corentin THOMASSET 2024-02-11 00:33:52 +01:00 committed by GitHub
parent 079aa2164c
commit dc0461595f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
478 changed files with 1029 additions and 1145 deletions

View file

@ -1,22 +1,7 @@
import messages from '@intlify/unplugin-vue-i18n/messages';
import { get } from '@vueuse/core';
import type { Plugin } from 'vue';
import { createI18n } from 'vue-i18n';
import baseMessages from '@intlify/unplugin-vue-i18n/messages';
import _ from 'lodash';
import { parse as parseYaml } from 'yaml';
const i18nFiles = import.meta.glob('../tools/*/locales/**.yml', { as: 'raw' });
const messagesByTools = await Promise.all(_.map(i18nFiles, async (fileDescriptor, path) => {
const [, locale] = path.match(/\.\/tools\/.*?\/locales\/(.*)\.ya?ml$/i) ?? [];
const content = parseYaml(await fileDescriptor());
return { [locale]: content };
}));
const messages = _.merge(
baseMessages,
_.merge({}, ...messagesByTools),
);
const i18n = createI18n({
legacy: false,
@ -31,7 +16,6 @@ export const i18nPlugin: Plugin = {
};
export const translate = function (localeKey: string) {
// @ts-expect-error global
const hasKey = i18n.global.te(localeKey, i18n.global.locale);
const hasKey = i18n.global.te(localeKey, get(i18n.global.locale));
return hasKey ? i18n.global.t(localeKey) : localeKey;
};

View file

@ -1,4 +0,0 @@
tools:
base64-file-converter:
title: Base64 file converter
description: Convert string, files or images into a it\'s base64 representation.

View file

@ -1,4 +0,0 @@
tools:
base64-file-converter:
title: Trình chuyển đổi tệp Base64
description: Chuyển đổi chuỗi, tệp hoặc hình ảnh thành mã Base64.

View file

@ -1,4 +0,0 @@
tools:
base64-file-converter:
title: Base64 文件转换器
description: 将字符串、文件或图像转换为其 Base64 表示形式。

View file

@ -1,4 +0,0 @@
tools:
base64-string-converter:
title: Base64 string encoder/decoder
description: Simply encode and decode string into a their base64 representation.

View file

@ -1,4 +0,0 @@
tools:
base64-string-converter:
title: Trình mã hóa/giải mã chuỗi Base64
description: Đơn giản mã hóa và giải mã chuỗi thành mã Base64.

View file

@ -1,4 +0,0 @@
tools:
base64-string-converter:
title: Base64 字符串编码/解码
description: 将字符串编码和解码为其 Base64 格式表示形式即可。

View file

@ -1,4 +0,0 @@
tools:
basic-auth-generator:
title: Basic auth generator
description: Generate a base64 basic auth header from an username and a password.

View file

@ -1,4 +0,0 @@
tools:
basic-auth-generator:
title: Tạo mã xác thực cơ bản
description: Tạo một tiêu đề xác thực cơ bản base64 từ tên người dùng và mật khẩu.

View file

@ -1,4 +0,0 @@
tools:
basic-auth-generator:
title: 基本身份验证生成器
description: 从用户名和密码生成 base64 基本身份验证标头。

View file

@ -1,4 +0,0 @@
tools:
bcrypt:
title: Bcrypt
description: Hash and compare text string using bcrypt. Bcrypt is a password-hashing function based on the Blowfish cipher.

View file

@ -1,4 +0,0 @@
tools:
bcrypt:
title: Bcrypt
description: Mã hóa và so sánh chuỗi văn bản sử dụng bcrypt. Bcrypt là một hàm mã hóa mật khẩu dựa trên thuật toán Blowfish.

View file

@ -1,4 +0,0 @@
tools:
bcrypt:
title: 加密
description: 使用bcrypt对文本字符串进行哈希和比较。Bcrypt是一个基于Blowfish密码的密码哈希函数。

View file

@ -1,4 +0,0 @@
tools:
benchmark-builder:
title: Benchmark builder
description: Easily compare execution time of tasks with this very simple online benchmark builder.

View file

@ -1,4 +0,0 @@
tools:
benchmark-builder:
title: Trình tạo bảng đánh giá
description: Dễ dàng so sánh thời gian thực thi của các nhiệm vụ với trình tạo bảng đánh giá trực tuyến đơn giản này.

View file

@ -1,4 +0,0 @@
tools:
benchmark-builder:
title: 基准生成器
description: 简单的在线基准构建器可以轻松比较任务的执行时间。

View file

@ -1,4 +0,0 @@
tools:
bip39-generator:
title: BIP39 passphrase generator
description: Generate BIP39 passphrase from existing or random mnemonic, or get the mnemonic from the passphrase.

View file

@ -1,4 +0,0 @@
tools:
bip39-generator:
title: Trình tạo BIP39 passphrase
description: Tạo BIP39 passphrase từ mnemonic hiện có hoặc ngẫu nhiên, hoặc lấy mnemonic từ passphrase.

View file

@ -1,4 +0,0 @@
tools:
bip39-generator:
title: BIP39密码生成器
description: 从现有或随机助记符生成BIP39密码短语或从密码短语获取助记符。

View file

@ -1,4 +0,0 @@
tools:
camera-recorder:
title: Camera recorder
description: Take a picture or record a video from your webcam or camera.

View file

@ -1,4 +0,0 @@
tools:
camera-recorder:
title: Ghi lại camera
description: Chụp ảnh hoặc quay video từ webcam hoặc máy ảnh của bạn.

View file

@ -1,4 +0,0 @@
tools:
camera-recorder:
title: 摄像机记录器
description: 从网络摄像头或照相机拍摄照片或录制视频。

View file

@ -1,4 +0,0 @@
tools:
case-converter:
title: Case converter
description: Change the case of a string and chose between different formats

View file

@ -1,4 +0,0 @@
tools:
case-converter:
title: Chuyển đổi chữ hoa/chữ thường
description: Thay đổi kiểu chữ của một chuỗi và chọn giữa các định dạng khác nhau

View file

@ -1,4 +0,0 @@
tools:
case-converter:
title: 大小写转换
description: 更改字符串的大小写并在不同格式之间进行选择

View file

@ -1,4 +0,0 @@
tools:
chmod-calculator:
title: Chmod calculator
description: Compute your chmod permissions and commands with this online chmod calculator.

View file

@ -1,4 +0,0 @@
tools:
chmod-calculator:
title: Máy tính Chmod
description: Tính toán quyền và lệnh chmod của bạn với máy tính Chmod trực tuyến này.

View file

@ -1,4 +0,0 @@
tools:
chmod-calculator:
title: Chmod 计算器
description: 使用此在线的chmod计算器计算chmod权限和命令。

View file

@ -1,4 +0,0 @@
tools:
chronometer:
title: Chronometer
description: Monitor the duration of a thing. Basically a chronometer with simple chronometer features.

View file

@ -1,4 +0,0 @@
tools:
chronometer:
title: Đồng hồ bấm giờ
description: Giám sát thời gian của một sự việc. Cơ bản là một đồng hồ bấm giờ với các tính năng đơn giản.

View file

@ -1,4 +0,0 @@
tools:
chronometer:
title: 计时器
description: 监控事物的持续时间。基本上是一种具有简单计时器功能的计时器。

View file

@ -1,4 +0,0 @@
tools:
color-converter:
title: Color converter
description: Convert color between the different formats (hex, rgb, hsl and css name)

View file

@ -1,4 +0,0 @@
tools:
color-converter:
title: Trình chuyển đổi màu
description: Chuyển đổi màu giữa các định dạng khác nhau (hex, rgb, hsl và tên css)

View file

@ -1,4 +0,0 @@
tools:
color-converter:
title: Color 选择器
description: 在不同格式十六进制、rgb、hsl和css名称之间转换颜色

View file

@ -1,4 +0,0 @@
tools:
crontab-generator:
title: Crontab generator
description: Validate and generate crontab and get the human readable description of the cron schedule.

View file

@ -1,4 +0,0 @@
tools:
crontab-generator:
title: Trình tạo Crontab
description: Xác thực và tạo crontab và lấy mô tả đọc được của lịch trình cron.

View file

@ -1,4 +0,0 @@
tools:
crontab-generator:
title: Crontab 表达式生成
description: 验证并生成crontab并获取cron调度的可读描述。

View file

@ -1,4 +0,0 @@
tools:
date-converter:
title: Date-time converter
description: Convert date and time into the various different formats

View file

@ -1,4 +0,0 @@
tools:
date-converter:
title: Chuyển đổi ngày-tháng
description: Chuyển đổi ngày và thời gian sang các định dạng khác nhau

View file

@ -1,4 +0,0 @@
tools:
date-converter:
title: 日期时间转换器
description: 将日期和时间转换为各种不同的格式

View file

@ -1,4 +0,0 @@
tools:
device-information:
title: Device information
description: Get information about your current device (screen size, pixel-ratio, user agent, ...)

View file

@ -1,4 +0,0 @@
tools:
device-information:
title: Thông tin thiết bị
description: Lấy thông tin về thiết bị hiện tại của bạn (kích thước màn hình, tỷ lệ pixel, user agent, ...)

View file

@ -1,4 +0,0 @@
tools:
device-information:
title: 设备信息
description: 获取有关当前设备的信息(屏幕大小、像素比率、用户代理…)

View file

@ -1,4 +0,0 @@
tools:
docker-run-to-docker-compose-converter:
title: Docker run to Docker compose converter
description: Turns docker run commands into docker-compose files!

View file

@ -1,4 +0,0 @@
tools:
docker-run-to-docker-compose-converter:
title: Chuyển đổi lệnh docker run thành tệp docker-compose
description: Chuyển đổi các lệnh docker run thành tệp docker-compose!

View file

@ -1,4 +0,0 @@
tools:
docker-run-to-docker-compose-converter:
title: Docker Run 到 docker-compose 转换器
description: 将 docker run 命令行转换为 docker-compose 文件!

View file

@ -1,4 +0,0 @@
tools:
emoji-picker:
title: Emoji picker
description: Copy and paste emojis easily and get the unicode and code points value of each emoji.

View file

@ -1,4 +0,0 @@
tools:
emoji-picker:
title: Bộ chọn biểu tượng cảm xúc
description: Sao chép và dán biểu tượng cảm xúc một cách dễ dàng và nhận giá trị unicode và mã điểm của mỗi biểu tượng cảm xúc.

View file

@ -1,4 +0,0 @@
tools:
emoji-picker:
title: Emoji 选择器
description: 轻松复制和粘贴Emoji表情符号并获得每个表情符号的unicode和code points值.

View file

@ -1,4 +0,0 @@
tools:
encryption:
title: Encrypt / decrypt text
description: Encrypt and decrypt text clear text using crypto algorithm like AES, TripleDES, Rabbit or RC4.

Some files were not shown because too many files have changed in this diff Show more