Skip to content

Commit

Permalink
Treat top-level directories as separate source code projects
Browse files Browse the repository at this point in the history
The 'app', 'chatbot' and 'common_tools' directories may use different
technologies, which require different tools to manage, so it seems best not to
treat them as part of a single project.
  • Loading branch information
istride committed Aug 16, 2021
1 parent 5421ccf commit 772d767
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 61 deletions.
47 changes: 7 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,46 +20,13 @@ For the app the possible types are: ???

## Getting started

Install latest Long-Term Support (LTS) release of Node.js.
See READMEs for each project.

Install project dependencies.
```
npm install
```

## Running the scripts

### Common tools

Identify messages that are mising a translation.
```
node common_tools\index missing ".\test_files\current_translation_list.json" ".\test_files\translation_dictionary.json" ".\test_files\output"
```

???
```
node common_tools\index match ".\test_files\output\missing_bits_to_translate.json" ".\test_files\translation_dictionary.json" ".\test_files\output"
```

???
```
node common_tools\index add_restored ".\test_files\output\selected_best_matches.json" ".\test_files\translation_dictionary.json" ".\test_files\output"
```

### Chatbot
- [App][1]
- [Chatbot][2]
- [Common tools][3]

To extract English-language strings from RapidPro flows, for translation.
```
node chatbot/index extract <rapidpro-json-file> <output-dir>
```

To merge translated strings back into original flow as a localization.
```
node chatbot/index localize <input-rapidpro-flow-file> <translated-strings-file> <language-code> <output-dir>
```

## Running tests

```
npm test
```
[1]: ./app/README_app.md
[2]: ./chatbot/README.md
[3]: ./common_tools/README.md
30 changes: 30 additions & 0 deletions chatbot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Chatbot translation tools

## Getting started

Install latest Long-Term Support (LTS) release of Node.js.

Install project dependencies.
```
npm install
```

## Running the scripts

To extract English-language strings from RapidPro flows, for translation.
```
node index extract <rapidpro-json-file> <output-dir>
```

To merge translated strings back into original flow as a localization.
```
node index localize <input-rapidpro-flow-file> <translated-strings-file> <language-code> <output-dir>
```

## Running tests

```
npm test
```


16 changes: 2 additions & 14 deletions package-lock.json → chatbot/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions package.json → chatbot/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "idems_translation",
"name": "idems_translation_chatbot",
"version": "1.0.0",
"description": "translation tools",
"main": ".\\common_tools\\index.js",
"description": "Translation tools for chatbots",
"main": "index.js",
"scripts": {
"test": "mocha"
},
Expand All @@ -16,9 +16,6 @@
"url": "https://github.com/fagiothree/idems_translation/issues"
},
"homepage": "https://github.com/fagiothree/idems_translation#readme",
"dependencies": {
"string-similarity": "^4.0.4"
},
"devDependencies": {
"mocha": "^9.0.2"
}
Expand Down
2 changes: 1 addition & 1 deletion test/export-test.js → chatbot/test/export-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const assert = require('assert');
const extract = require('../chatbot/extract/extract.js');
const extract = require('../extract/extract.js');


describe(
Expand Down
29 changes: 29 additions & 0 deletions common_tools/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Common translation tools

## Getting started

Install latest Long-Term Support (LTS) release of Node.js.

Install project dependencies.
```
npm install
```

## Running the scripts

### Common tools

Identify messages that are mising a translation.
```
node index missing ".\test_files\current_translation_list.json" ".\test_files\translation_dictionary.json" ".\test_files\output"
```

???
```
node index match ".\test_files\output\missing_bits_to_translate.json" ".\test_files\translation_dictionary.json" ".\test_files\output"
```

???
```
node index add_restored ".\test_files\output\selected_best_matches.json" ".\test_files\translation_dictionary.json" ".\test_files\output"
```
28 changes: 28 additions & 0 deletions common_tools/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions common_tools/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "idems_translation_common",
"version": "1.0.0",
"description": "Common translation tools",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/fagiothree/idems_translation.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/fagiothree/idems_translation/issues"
},
"homepage": "https://github.com/fagiothree/idems_translation#readme",
"dependencies": {
"string-similarity": "^4.0.4"
}
}

0 comments on commit 772d767

Please sign in to comment.