Skip to content

Commit d9fddb0

Browse files
committed
feat: initial support for translation keys
1 parent 69d87e2 commit d9fddb0

35 files changed

+353
-67
lines changed

.eslintrc.cjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ module.exports = {
4141
'operator-linebreak': ['error', 'after'],
4242
quotes: ['error', 'single', { allowTemplateLiterals: true, avoidEscape: true }],
4343
'no-extra-boolean-cast': 'warn',
44-
'import/extensions': ['error', 'ignorePackages'],
44+
'import/extensions': ['error', 'ignorePackages', {
45+
ts: 'always',
46+
js: 'always',
47+
json: 'always',
48+
}],
4549
'import/no-extraneous-dependencies': ['error', {
4650
devDependencies: ['./scripts/**', './test/**', '*'],
4751
optionalDependencies: false,

.github/workflows/translation.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Bundle Translations
2+
on:
3+
workflow_dispatch:
4+
push:
5+
paths:
6+
- 'lang/**'
7+
- '!lang/undercards.json'
8+
jobs:
9+
bundle:
10+
name: Bundle
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
registry-url: "https://registry.npmjs.org"
19+
- name: Install dependencies
20+
run: npm install
21+
- name: Bundle
22+
run: npm run bundle
23+
- name: Commit
24+
uses: EndBug/add-and-commit@v9
25+
with:
26+
message: "chore: update translation file"
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+

lang/en/chat.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"reconnecting": "Reconnecting..."
3+
}

lang/en/menu.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"menu": "MENU"
3+
}

lang/en/settings.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"autocomplete": "Visual Autocomplete",
3+
"autocomplete.friends": "Autocomplete: Online Friends Only",
4+
"large.avatar": "Large Icon mode",
5+
"category.announce.draw": "Legendary Draw",
6+
"category.announce.user": "Legendary User",
7+
"category.chat.commands": "Commands",
8+
"category.chat.ignored": "Ignored Users",
9+
"category.chat.links": "Trusted Domains",
10+
"category.chat.ping": "Ping Me",
11+
"disable.broadcast": "Disable Broadcast Toast",
12+
"disable.command": "Disable $1 command",
13+
"disable.emote": "Disable $1",
14+
"disable.rightclick": "Disable Chat Context (right click)",
15+
"disable.ignoreChat": "Disable",
16+
"disable.links": "Use Original Link Detection",
17+
"disable.ping": "Disable Chat Ping {{STYLE:highlight|(highlighting)}}",
18+
"ignoreChat": "Behavior",
19+
"announce": "Announcement",
20+
"announce.friendsOnly": "Friends Only",
21+
"announce.notSelf": "Ignore Self",
22+
"page.chat": "Chat",
23+
"ping.global": "Only open chats",
24+
"ping.on": "On",
25+
"ping.toast": "Enable ping toasts",
26+
"safelink": "Enabled",
27+
"safelink.trust": "Trust $1"
28+
}

lang/en/toast.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"broadcast": "[INFO] Undercards Broadcast Message",
3+
"dismiss": "Dismiss",
4+
"ignore": "You've ignored $1",
5+
"ping": "UnderScript has custom notifications! You can change them however you like.",
6+
"ping.remove": "Remove @underscript!",
7+
"ping.settings": "Open settings",
8+
"game.request": "Request Permission",
9+
"game.request.allowed": "Notifications allowed",
10+
"game.request.denied": "Notifications denied",
11+
"game.request.message": "UnderScript would like to notify you when a game is found.",
12+
"undo": "Undo"
13+
}

package-lock.json

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"@rollup/plugin-multi-entry": "^4.1.0",
4747
"@rollup/plugin-node-resolve": "^11.2.1",
4848
"@rollup/plugin-replace": "^3.1.0",
49+
"@rollup/plugin-typescript": "^12.1.2",
4950
"@rollup/pluginutils": "^5.1.4",
5051
"@types/jquery": "^2.0.68",
5152
"chai": "^4.3.7",
@@ -63,6 +64,7 @@
6364
"rollup-plugin-import-css": "^3.2.1",
6465
"stylelint": "^14.16.1",
6566
"stylelint-config-standard": "^29.0.0",
67+
"tslib": "^2.8.1",
6668
"typescript": "^5.8.2"
6769
},
6870
"dependencies": {

rollup.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import css from 'rollup-plugin-import-css';
1010
import replace from '@rollup/plugin-replace';
1111
import alias from '@rollup/plugin-alias';
1212
import path from 'path';
13+
import typescript from '@rollup/plugin-typescript';
1314

1415
import { version } from './package.json';
1516
import importString from './scripts/import-string.js';
@@ -50,7 +51,6 @@ export default [{
5051
input: {
5152
include: [
5253
'src/utils/0.publicist.js',
53-
'src/base/index.js',
5454
'src/base/**/*.js',
5555
'src/hooks/**/*.js',
5656
],
@@ -91,6 +91,11 @@ export default [{
9191
},
9292
}),
9393
nodeResolve({ browser: true }),
94+
typescript({
95+
outDir: './dist',
96+
target: 'ES2023',
97+
tsconfig: './src/tsconfig.json',
98+
}),
9499
css(),
95100
importString({
96101
include: ['**/*.html'],

scripts/.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
},
55
rules: {
66
'import/extensions': ['error', {
7-
js: 'never',
7+
js: 'always',
88
json: 'always',
99
}],
1010
'no-console': 'off',

0 commit comments

Comments
 (0)