-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Create parse-langtags utility to convert langtags.json (#24)
* feat: Create parse-langtags utility to convert langtags.json * revert DoulosSILR.ttf font * fix: parse-langtags to handle edge cases * Remove `|` from language name because it's a delimiter character * Handle `XK` as industry region for "Kosovo" * Handle registered `valencia`subtag * Ignore `x-bad-mru-Cyrl-RU` * fix: Rewrite how iso639.txt is converted to codes * chore: Update readme info * chore: Clean up typo and whitespace
- Loading branch information
1 parent
5b5eba4
commit 6c98eb3
Showing
16 changed files
with
11,721 additions
and
537 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Editor configuration, see https://editorconfig.org | ||
root = true | ||
|
||
[*.{js,ts}] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
max_line_length = off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Dependencies | ||
node_modules | ||
|
||
langtags.json | ||
|
||
# Compiled Output files | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug Program", | ||
"sourceMaps": true, | ||
"program": "${workspaceFolder}/dist/index.js", | ||
"outFiles": [ | ||
"${workspaceFolder}/dist/**.js" | ||
], | ||
"args": [ | ||
"-o", "iso639.txt" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "typescript", | ||
"tsconfig": "tsconfig.json", | ||
"problemMatcher": [ | ||
"$tsc" | ||
], | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 SIL International | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
|
||
# parse-langtags | ||
Utility to convert [langtags.json](https://github.com/silnrsi/langtags) into a language list for Speech Analyzer. | ||
|
||
## Usage | ||
Command-line: | ||
```bash | ||
node dist/index.js | ||
-o [output file] | ||
``` | ||
|
||
Typically, use `iso639.txt` for the output file name. | ||
|
||
----- | ||
|
||
### Get the latest langtags.json file | ||
This will download the latest copy of langtags.json into this current folder | ||
|
||
`npm run get` | ||
|
||
---- | ||
|
||
### Convert langtags.json | ||
1. Compile the project | ||
`npm run build` | ||
2. Convert langtags.json into an output file (e.g. iso639.txt) | ||
`node dist/index.js -o iso639.txt` | ||
------------------ | ||
|
||
|
||
## Developer Setup | ||
This utility requires Git, Node.js, and TypeScript (installed locally). | ||
|
||
### Install Git | ||
Download and install Git | ||
|
||
https://git-scm.com/downloads | ||
|
||
### Install Node.js and Dependencies | ||
Download and install the latest current version for Node.js (>=14.15.0) | ||
|
||
https://nodejs.org/en/download/current/ | ||
|
||
After installing Node.js, reboot your PC, open Git Bash to this directory and install this project's dependencies: | ||
```bash | ||
npm install | ||
``` | ||
|
||
This will install [TypeScript](https://www.typescriptlang.org/) locally and can be accessed with | ||
|
||
```bash | ||
npx tsc | ||
``` | ||
|
||
### Compiling parse-langs | ||
This compiles the TypeScript source files in `src/` into Javascript (`dist/`) | ||
|
||
To rebuild the project | ||
```bash | ||
npm run build | ||
``` | ||
|
||
You can also have TypeScript watch the project and recompile automatically | ||
```bash | ||
npm run watch | ||
``` | ||
|
||
### Debugging with Visual Studio Code | ||
Open Folder as a VS Code Project | ||
|
||
Edit your applicable parameters in [launch.json](./.vscode/launch.json). If using Windows paths, you'll need to escape the slashes (e.g. `-p "C:\\somewhere\\to\\iso639.txt"`) | ||
|
||
------------- | ||
|
||
## License for parse-langtags | ||
Copyright (c) 2021 SIL International. All rights reserved. | ||
Licensed under the [MIT license](LICENSE). |
Oops, something went wrong.