Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
simeononsecurity committed Nov 2, 2023
2 parents d609c05 + e09c9ec commit e420f48
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 34 deletions.
55 changes: 33 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,35 @@
WARNING: There are no guarantees that this code has no security vulnerabilities. Please use at your own risk.
# Glotta
Script that translates Hugo markdown file content into other languages.

### Glotta
[View Glotta on NPM](https://www.npmjs.com/package/glotta)

Script that translates Hugo markdown file content into other languages.
## Notes and Warnings
**WARNING**: There are no guarantees that this code has no security vulnerabilities. The code is provided as-is. We hold no responcibility for how you use it.

## Supported Languages

### Google Translate

`ar, bn, ca, de, en, es, fr, hi, it, ja, pa, pt, ro, ru, zh`

### Deepl

`de, en, es, fr, it, ja, nl, pl, ro, ru, zh`

## How to change Translation API Provider

#### Example command:
Set the `TRANSLATE_PROVIDER` environment variable to either `GOOGLE` or `DEEPL`, and be sure to set your `DEEPL_AUTH_KEY` as well.
The test suites will rely on these env variables so you can test your integration by running `npm test`

For example:
```sh
GOOGLE_APPLICATION_CREDENTIALS=./gcloud-keys/dev-service-account-keys.json
DEEPL_AUTH_KEY= **********
TRANSLATE_PROVIDER=DEEPL
```

## How to run Glotta
#### Example Glotts command:

```sh
node src/index.js --source=__fixtures__ --recursive --force
Expand All @@ -14,7 +39,7 @@ node src/index.js --source=__fixtures__ --recursive --force
# --targetLanguageIds is another option that can be specified (default target ids are: ar, bn, ca, zh, fr, de, hi, it, ja, pt, pa, ro, ru, es
```

#### Example output:
#### Example Glotts Output:
```txt
========== glotta ============
dir: __fixtures__/simeon-usecase-dir/content/articles/a-beginners-guide-to-setting-up-a-secure-and-resilient-vpn-for-remote-workers
Expand All @@ -35,34 +60,20 @@ writing new file...
translating text into... pa
```

## How to change Translation API Provider

Set the `TRANSLATE_PROVIDER` environment variable to either `GOOGLE` or `DEEPL`, and be sure to set your `DEEPL_AUTH_KEY` as well.
The test suites will rely on these env variables so you can test your integration by running `npm test`

For example:
```sh
GOOGLE_APPLICATION_CREDENTIALS=./gcloud-keys/dev-service-account-keys.json
DEEPL_AUTH_KEY= **********
TRANSLATE_PROVIDER=DEEPL
```

## Learn more about [glotta and translating hugo index bundles](https://simeononsecurity.ch/other/glotta-streamlining-hugo-text-translation-for-global-reach/)

## Author:

[1nf053c](https://github.com/1nf053c)
[1nf053c](https://github.com/1nf053c) from [compassionandhardwork.com](https://compassionandhardwork.com)

## Owner:

[simeononsecurity](https://github.com/simeononsecurity)
[simeononsecurity](https://github.com/simeononsecurity) from [simeononsecurity.ch](https://simeononsecurity.ch)

## License

[MIT](https://github.com/simeononsecurity/glotta/blob/main/LICENSE)

## Learn more about [glotta and translating hugo index bundles](https://simeononsecurity.ch/other/glotta-streamlining-hugo-text-translation-for-global-reach/)


<a href="https://simeononsecurity.ch" target="_blank" rel="noopener noreferrer">
  <h2>Explore the World of Cybersecurity</h2>
</a>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "glotta",
"version": "1.0.5",
"version": "1.0.6",
"description": "",
"main": "src/index.js",
"scripts": {
Expand Down
22 changes: 11 additions & 11 deletions src/assert-valid-language-id.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
const { TRANSLATE_PROVIDERS } = require("./assert-valid-translate-provider");

const LANGUAGE_IDS = process.env.TRANSLATE_PROVIDER === TRANSLATE_PROVIDERS.DEEPL ? {
de: 'de',
fr: 'fr',
es: 'es',
ja: 'ja',
it: 'it',
pl: 'pl',
nl: 'nl',
en: 'en',
ro: 'ro',
ru: 'ru',
zh: 'zh'
    de: 'de',
    fr: 'fr',
    es: 'es',
    ja: 'ja',
    it: 'it',
    pl: 'pl',
    nl: 'nl',
    en: 'en',
    ro: 'ro',
    ru: 'ru',
    zh: 'zh'
} : {
ar: 'ar',
bn: 'bn',
Expand Down

0 comments on commit e420f48

Please sign in to comment.