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.
Files changed (4) hide show
  1. package/README.md +18 -12
  2. package/bayda-bin +1 -1
  3. package/package.json +1 -2
  4. 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
- ## v1.0 - 7 dialects green ✅
5
+ ## Dialects
6
6
 
7
- | Code | Name | File | Entries |
7
+ | Code | Name | File | Words |
8
8
  |------|------|------|-------|
9
- | kab | Kabyle | kabyle.json | 68 |
10
- | kab-lat | Kabyle Latin | kabyle-latin.json | 103 |
11
- | ly | Libya | libya.json | 245 |
12
- | mauritania | Mauritania | mauritania.json | 177 |
13
- | tn-latn | Tounsi | tunisia_franco.json | 188 |
14
- | dz | Dzair Arabic | algeria.json | 97 |
15
- | dz-latn | Dzair Franco | algeria_franco.json | 100 |
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
- CLI:
24
+ Command line. The dialect comes from the file name (hello.kab.bayda), or from --dialect:
25
25
 
26
- npx bayda-maghreb file.bayda tn-latn
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
- Dialects: kab, kab-lat, ly, mauritania, tn-latn, dz, dz-latn
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.log("bayda --help"); process.exit(1); }
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.16",
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));