File size: 4,918 Bytes
557a17a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# Languages
Supports international versions of repositories: <a href="https://github.com/luciangreen/listprologinterpreter">List Prolog Interpreter</a>.
# Getting Started
Please read the following instructions on how to install the project on your computer for coding in other languages.
# Prerequisites
* Please download and install SWI-Prolog for your machine at `https://www.swi-prolog.org/build/`.
* You may need to install gawk using Homebrew.
* Install <a href="https://github.com/soimort/translate-shell">Translation Shell</a> on Mac, etc.
Change line in
```
culturaltranslationtool/ctt2.pl
trans_location("../../../gawk/trans").
```
to correct location of <a href="https://github.com/soimort/translate-shell">trans</a>.
# 1. Install manually
Download <a href="http://github.com/luciangreen/Languages/">this repository</a>, <a href="http://github.com/luciangreen/Prolog-to-List-Prolog/">Prolog to List Prolog</a>, the <a href="https://github.com/luciangreen/listprologinterpreter">List Prolog Interpreter</a> and <a href="https://github.com/luciangreen/culturaltranslationtool">Cultural Translation Tool</a>.
# 2. Or Install from List Prolog Package Manager (LPPM)
* Download the <a href="https://github.com/luciangreen/List-Prolog-Package-Manager">LPPM Repository</a>:
```
mkdir GitHub
cd GitHub/
git clone https://github.com/luciangreen/List-Prolog-Package-Manager.git
cd List-Prolog-Package-Manager
swipl
['lppm'].
lppm_install("luciangreen","Languages").
halt
```
# Running
* In Shell:
`cd listprologinterpreter`
`['listprolog'].`
* Running the tests: See <a href="https://github.com/luciangreen/listprologinterpreter">List Prolog Interpreter</a>.
# Languages commands
* To install a new language for LPI (see available <a href="https://github.com/soimort/translate-shell">language codes</a>):
```
cd Languages
swipl
['lang_db_generator.pl'].
lang_db_generator("en2",["de","ga"]).
```
to install German (de) and Irish (ga) (in the listprologinterpreter/languages folder, not in the Languages repository). The English2 file is used to translate English commands.
* To generate LPI documentation in language "en2" (i.e. "concatenate strings" instead of "stringconcat"):
```
cd Languages
swipl
['../listprologinterpreter/listprolog.pl'].
make_docs("docs_full.txt").
```
* To generate LPI documentation in a language:
```
cd Languages
swipl
['make_docs.pl'].
% run one of the following lines every few hours
make_docs("docs1.txt").
make_docs("docs2.txt").
make_docs("docs3.txt").
make_docs("docs4.txt").
make_docs("docs5.txt").
make_docs("docs6.txt").
make_docs("docs6-1.txt").
make_docs("docs6-2.txt").
make_docs("docs7.txt").
make_docs("docs8.txt").
make_docs("docs9.txt").
make_docs("docs10.txt").
make_docs("docs11.txt").
make_docs("docs12.txt").
```
The following is displayed, and the user enters a language code (installed from the previous step):
```
Enter target language code for LPI docs:
|: fr
```
* Note: The trans shell software has a quota, so it is recommended to translate 60 words of doc.txt at a time by editing it before running.
* You could translate docs.txt into the target language "en2" and then into your chosen target language with Google Translate.
* To translate an algorithm from one language to another:
```
cd Languages
swipl
['make_docs.pl'].
trans_alg([[[n,reverse],[[],[v,l],[v,l]]],[[n,reverse],[[v,l],[v,m],[v,n]],":-",[[[n,head],[[v,l],[v,h]]],[[n,tail],[[v,l],[v,t]]],[[n,wrap],[[v,h],[v,h1]]],[[n,append],[[v,h1],[v,m],[v,o]]],[[n,reverse],[[v,t],[v,o],[v,n]]]]]],"en","fr",A),writeln1(A).
[[["n","inverser"],[[],["v","l"],["v","l"]]],[["n","inverser"],[["v","l"],["v","m"],["v","n"]],":-",[[["n","tête"],[["v","l"],["v","h"]]],[["n","queue"],[["v","l"],["v","t"]]],[["n","emballage"],[["v","h"],["v","h 1"]]],[["n","ajouter"],[["v","h 1"],["v","m"],["v","o"]]],[["n","inverser"],[["v","t"],["v","o"],["v","n"]]]]]]
```
* Note: When translating an algorithm from another language to English, it is better to avoid errors from capitalised strings by using the language code "en2" rather than "en", i.e.
```
trans_alg([[[n,reverse],[[],[v,l],[v,l]]],[[n,reverse],[[v,l],[v,m],[v,n]],":-",[[[n,head],[[v,l],[v,h]]],[[n,tail],[[v,l],[v,t]]],[[n,wrap],[[v,h],[v,h1]]],[[n,append],[[v,h1],[v,m],[v,o]]],[[n,reverse],[[v,t],[v,o],[v,n]]]]]],"en","en2",A),writeln1(A).
[[["n","reverse"],[[],["v","l"],["v","l"]]],[["n","reverse"],[["v","l"],["v","m"],["v","n"]],":-",[[["n","head"],[["v","l"],["v","h"]]],[["n","tail"],[["v","l"],["v","t"]]],[["n","wrap"],[["v","h"],["v","h 1"]]],[["n","append"],[["v","h 1"],["v","m"],["v","o"]]],[["n","reverse"],[["v","t"],["v","o"],["v","n"]]]]]]
```
# Versioning
We will use SemVer for versioning.
# Authors
Lucian Green - Initial programmer - <a href="https://www.lucianacademy.com/">Lucian Academy</a>
# License
I licensed this project under the BSD3 License - see the LICENSE.md file for details
|