Skip to content

Commit 73f83b7

Browse files
authored
Merge pull request #19 from neverRare/master
0.2.1
2 parents 8dadfb2 + 3a70bcc commit 73f83b7

File tree

11 files changed

+1643
-242
lines changed

11 files changed

+1643
-242
lines changed

.github/workflows/deno.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1-
# Simple workflow for deploying static content to GitHub Pages
21
name: Build and Deploy
32

43
on:
5-
# Runs on pushes targeting the default branch
64
push:
75
branches: ["release"]
86

9-
# Allows you to run this workflow manually from the Actions tab
107
workflow_dispatch:
118

12-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
139
permissions:
1410
contents: read
1511
pages: write
1612
id-token: write
1713

18-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
2014
concurrency:
2115
group: "pages"
2216
cancel-in-progress: false
@@ -30,19 +24,17 @@ jobs:
3024
steps:
3125
- name: Checkout
3226
uses: actions/checkout@v4
33-
3427
- name: Setup Deno
3528
uses: denoland/setup-deno@v1
3629
with:
3730
deno-version: v1.x
38-
- name: Run a one-line script
31+
- name: Build
3932
run: deno task build
4033
- name: Setup Pages
4134
uses: actions/configure-pages@v4
4235
- name: Upload artifact
4336
uses: actions/upload-pages-artifact@v3
4437
with:
45-
# Upload entire repository
4638
path: "."
4739
- name: Deploy to GitHub Pages
4840
id: deployment

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"cSpell.customDictionaries": {
3-
"ku-suli": {
3+
"nimi-ku-suli": {
44
"name": "ku-suli",
55
"path": "${workspaceRoot}/nimi-ku-suli.txt",
6-
"description": "Ku Suli words of Toki Pona",
6+
"description": "nimi ku sili",
77
"addWords": true
88
}
99
},

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
You may need to force restart the page in order to use the latest version: shift + click the restart button; or ctrl + shift + R.
4+
5+
## 0.2.1
6+
7+
The project has been renamed to ilo Token. The definition list has been given a huge overhaul.
8+
9+
- Change name to ilo Token.
10+
- Remove unintended commas, these were found when translating "en" with more than 3 phrases.
11+
- Remove copyright and license footer.
12+
- Update definition list:
13+
- It now uses latest Linku definition as the base.
14+
- Include verbs for later use.
15+
- Include interjection for later use.
16+
317
## 0.2.0
418

519
For this version. The whole code has been rewritten. The translator can now translate few more things! Although it's still not capable of translating full sentences.
@@ -9,6 +23,7 @@ For this version. The whole code has been rewritten. The translator can now tran
923
- Reduplication
1024
- _nanpa_ particle
1125
- _en_ and _anu_
26+
- _o_ vocative like "jan Koko o"
1227
- Add button for translating, replacing auto-translate when typing.
1328
- (Downgrade) Drop support for "a" particle.
1429
- (Downgrade) Error messages are now very unreliable.

README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
1-
# Toki Pona Translator
1+
# ilo Token
22

3-
An imperfect Toki Pona to English translator that translates into multiple sentences. This emphasizes how broad Toki Pona can be. Everything is hardcoded, no machine learning involved.
3+
> The repository and the website uses to old name, it will be renamed on the next update.
4+
5+
A rule-based Toki Pona to English translator that translates into multiple sentences. This emphasizes how broad Toki Pona can be. Everything is hardcoded, no machine learning involved.
46

57
[Try it](https://neverrare.github.io/toki-pona-translator/)
68

79
## Building
810

11+
This builds `./main.js` as a minified file ready for production use.
12+
913
You'll need [Deno](https://deno.com/). Run the following command.
1014

1115
```
12-
git clone https://github.com/neverRare/toki-pona-translator.git
13-
cd toki-pona-translator
1416
deno task build
1517
```
1618

17-
Then open `./index.html` using your favorite browser.
19+
## Watching
20+
21+
This builds `./main.js` as a non-minified file with source mapping, intended for testing and debugging. This command also watches the source codes in `./src/` path and rebuilds `./main.js` whenever there are changes.
22+
23+
You'll need [Deno](https://deno.com/). Run the following command.
24+
25+
```
26+
deno task watch
27+
```
28+
29+
To stop this command, simply press Ctrl + C.
30+
31+
## About the source codes
1832

19-
Whenever you made changes to `./src/*.ts`, you'll need to run `deno task build` again and refresh the browser. Later I'll make a script to automate this.
33+
With exception to `./src/main.ts`, every source codes in `./src/` are environment agnostic. Meaning it can be run on Deno as well. This makes it convenient to directly test codes by using `deno run`.

bundle.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
1-
import { bundle } from "https://deno.land/x/[email protected]/mod.ts";
1+
import { emit } from "./dev-deps.ts";
2+
import { debounce } from "./dev-deps.ts";
23

34
const SOURCE = "./src/main.ts";
45
const DESTINATION = "./main.js";
56

67
const url = new URL(SOURCE, import.meta.url);
7-
const result = await bundle(url);
88

9-
const { code } = result;
10-
await Deno.writeTextFile(DESTINATION, code);
9+
async function build(options: emit.BundleOptions): Promise<void> {
10+
const result = await emit.bundle(url, options);
11+
const { code } = result;
12+
await Deno.writeTextFile(DESTINATION, code);
13+
}
14+
if (Deno.args[0] === "build") {
15+
await build({ minify: true });
16+
} else if (Deno.args[0] === "watch") {
17+
const builder = debounce.debounce(async () => {
18+
console.log("Starting to build...");
19+
await build({ compilerOptions: { inlineSourceMap: true } });
20+
console.log("Building done!");
21+
}, 500);
22+
const watcher = Deno.watchFs("./src/");
23+
builder();
24+
for await (const _ of watcher) {
25+
builder();
26+
}
27+
} else {
28+
throw new Error(`Unrecognized build option, ${Deno.args[0]}`);
29+
}

deno.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"lib": ["dom", "dom.iterable", "dom.asynciterable", "deno.ns"]
66
},
77
"tasks": {
8-
"build": "deno run --allow-read --allow-write --allow-env --allow-net ./bundle.ts"
8+
"build": "deno run --allow-read --allow-write --allow-env --allow-net ./bundle.ts build",
9+
"watch": "deno run --allow-read --allow-write --allow-env --allow-net ./bundle.ts watch"
910
},
1011
"fmt": {
1112
"include": ["./src/**/*.ts", "./bundle.ts", "./test-parser.ts"]

dev-deps.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * as emit from "https://deno.land/x/[email protected]/mod.ts";
2+
export * as debounce from "https://deno.land/[email protected]/async/debounce.ts";

index.html

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,24 @@
55
<meta name="author" content="neverRare" />
66
<meta
77
name="description"
8-
content="Toki Pona sentence to multi English sentence translator"
8+
content="A rule-based Toki Pona to English translator"
99
/>
1010
<link
1111
rel="stylesheet"
1212
href="https://necolas.github.io/normalize.css/8.0.1/normalize.css"
1313
/>
1414
<link rel="stylesheet" href="./style.css" />
1515
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
16-
<title>Toki Pona Translator</title>
16+
<title lang="tok">ilo Token</title>
1717
</head>
1818
<body>
19-
<h1>Toki Pona Translator</h1>
19+
<h1 lang="tok">ilo Token</h1>
2020
<p>
2121
<strong>⚠ WARNING:</strong> Work in progress; Some things may not work
2222
properly.
2323
</p>
2424
<p>
25-
An imperfect Toki Pona to English translator that translates into multiple
26-
sentences.
25+
A rule-based Toki Pona to English translator.
2726
<a
2827
href="https://github.com/neverRare/toki-pona-translator/wiki/Limitations"
2928
>Limitations</a
@@ -32,6 +31,7 @@ <h1>Toki Pona Translator</h1>
3231
<textarea id="input" placeholder="o toki tawa ni" lang="tok"></textarea>
3332
<div>
3433
<button id="translate-button">Translate</button>
34+
<button id="settings-button">Settings</button>
3535
</div>
3636
<ul id="output"></ul>
3737
<p id="error"></p>
@@ -47,7 +47,7 @@ <h1>Toki Pona Translator</h1>
4747
<li>
4848
Join
4949
<a href="https://discord.gg/Byqn5z9"
50-
><i>ma pona pi toki pona</i> Discord Server</a
50+
><i lang="tok">ma pona pi toki pona</i> Discord Server</a
5151
>
5252
and ping me (never_rare) at dedicated forum channel:
5353
<a
@@ -67,13 +67,8 @@ <h1>Toki Pona Translator</h1>
6767
<p>
6868
<a
6969
href="https://github.com/neverRare/toki-pona-translator/blob/master/CHANGELOG.md"
70-
>v0.2.0</a
71-
>
72-
- &copy; 2024 neverRare -
73-
<a
74-
href="https://github.com/neverRare/toki-pona-translator/blob/master/LICENSE"
75-
>MIT License</a
76-
>
70+
id="version"
71+
></a>
7772
</p>
7873
</footer>
7974
</body>

0 commit comments

Comments
 (0)