bayda-maghreb 1.1.16 → 1.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -12
- package/bayda-bin +1 -1
- package/package.json +1 -2
- package/cli.js +0 -10
package/README.md
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
North African dialect transliteration library - Kabyle, Libya, Tunisia, Algeria, Mauritania.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Dialects
|
|
6
6
|
|
|
7
|
-
| Code | Name | File |
|
|
7
|
+
| Code | Name | File | Words |
|
|
8
8
|
|------|------|------|-------|
|
|
9
|
-
| kab | Kabyle | kabyle.json |
|
|
10
|
-
| kab-lat | Kabyle Latin | kabyle-latin.json |
|
|
11
|
-
| ly | Libya | libya.json |
|
|
12
|
-
| mauritania | Mauritania | mauritania.json | 177 |
|
|
13
|
-
| tn-latn | Tounsi | tunisia_franco.json |
|
|
14
|
-
| dz | Dzair
|
|
15
|
-
| dz-latn | Dzair Franco | algeria_franco.json |
|
|
9
|
+
| kab | Kabyle | kabyle.json | 72 |
|
|
10
|
+
| kab-lat | Kabyle Latin | kabyle-latin.json | 104 |
|
|
11
|
+
| ly | Libya | libya.json | 337 |
|
|
12
|
+
| mauritania | Mauritania Gen Z | mauritania.json | 177 |
|
|
13
|
+
| tn-latn | Tounsi Franco | tunisia_franco.json | 205 |
|
|
14
|
+
| dz | Dzair | algeria.json | 110 |
|
|
15
|
+
| dz-latn | Dzair Franco | algeria_franco.json | 114 |
|
|
16
16
|
|
|
17
17
|
## Install
|
|
18
18
|
|
|
@@ -21,13 +21,19 @@ npm install bayda-maghreb
|
|
|
21
21
|
|
|
22
22
|
## Usage
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Command line. The dialect comes from the file name (hello.kab.bayda), or from --dialect:
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
bayda init create hello.kab.bayda
|
|
27
|
+
bayda init --dialect tn-latn create hello.tn-latn.bayda
|
|
28
|
+
bayda hello.kab.bayda translate and run
|
|
29
|
+
bayda hello.kab.bayda --js print the JavaScript only
|
|
30
|
+
bayda prog.bayda --dialect ly choose the dialect by hand
|
|
31
|
+
|
|
32
|
+
If the file name has no dialect code, kab is used.
|
|
27
33
|
|
|
28
34
|
Code:
|
|
29
35
|
|
|
30
36
|
import { transpile } from "bayda-maghreb";
|
|
31
37
|
console.log(transpile(source, "tn-latn"));
|
|
32
38
|
|
|
33
|
-
|
|
39
|
+
Only language words (if, else, function, console.log and so on) are translated. Text in quotes and comments stay as they are. The mauritania file is a word list, so it does not translate code.
|
package/bayda-bin
CHANGED
|
@@ -46,7 +46,7 @@ const di = args.indexOf("--dialect");
|
|
|
46
46
|
let code = di >= 0 ? args[di + 1] : null;
|
|
47
47
|
const skip = di >= 0 ? di + 1 : -1;
|
|
48
48
|
const cmd = args.find((a, i) => !a.startsWith("-") && i !== skip);
|
|
49
|
-
if (!cmd) { console.
|
|
49
|
+
if (!cmd) { console.error("usage: bayda <file> [--dialect code] [--js] | bayda init [--dialect code]"); process.exit(1); }
|
|
50
50
|
const pick = c => dialects.find(d => d.code === c);
|
|
51
51
|
const dataFile = d => join(__dirname, "data/dialects", d.file);
|
|
52
52
|
if (cmd === "init") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bayda-maghreb",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.17",
|
|
4
4
|
"description": "Bayda Maghreb - 7 dialects clean + Gen 2 Tech",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"lahjat",
|
|
42
42
|
"data",
|
|
43
43
|
"bayda-transpile.cjs",
|
|
44
|
-
"cli.js",
|
|
45
44
|
"bayda-bin"
|
|
46
45
|
],
|
|
47
46
|
"engines": {
|
package/cli.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
import { transpile } from "./index.js";
|
|
4
|
-
|
|
5
|
-
const [file, dialect] = process.argv.slice(2);
|
|
6
|
-
if (!file) {
|
|
7
|
-
console.error("usage: bayda <file> [dialect]");
|
|
8
|
-
process.exit(1);
|
|
9
|
-
}
|
|
10
|
-
console.log(transpile(fs.readFileSync(file, "utf8"), dialect));
|