Pull request: scripts: imp i18n upload script
Merge in DNS/adguard-home from imp-i18n-script to master Squashed commit of the following: commit 2ea88dcfaf24722f2b7568802a54cbe4f8ebc084 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Dec 3 16:05:00 2021 +0300 scripts: imp i18n upload script
This commit is contained in:
parent
9c6d139913
commit
0122710750
|
@ -6,6 +6,8 @@
|
|||
|
||||
Run `make init` from the project root.
|
||||
|
||||
|
||||
|
||||
## `querylog/`: Query Log Helpers
|
||||
|
||||
### Usage
|
||||
|
@ -14,12 +16,16 @@ Run `make init` from the project root.
|
|||
* `npm run anonymize <source> <dst>`: read the query log from the `<source>`
|
||||
and write anonymized version to `<dst>`.
|
||||
|
||||
|
||||
|
||||
## `make/`: Makefile Scripts
|
||||
|
||||
The release channels are: `development` (the default), `edge`, `beta`, and
|
||||
`release`. If verbosity levels aren't documented here, there are only two: `0`,
|
||||
don't print anything, and `1`, be verbose.
|
||||
|
||||
|
||||
|
||||
### `build-docker.sh`: Build A Multi-Architecture Docker Image
|
||||
|
||||
Required environment:
|
||||
|
@ -38,6 +44,8 @@ Optional environment:
|
|||
* `SUDO`: allow users to use `sudo` or `doas` with `docker`. By default none
|
||||
is used.
|
||||
|
||||
|
||||
|
||||
### `build-release.sh`: Build A Release For All Platforms
|
||||
|
||||
Required environment:
|
||||
|
@ -67,6 +75,8 @@ Optional environment:
|
|||
* `VERSION`: release version. Will be set by `version.sh` if it is unset or
|
||||
if it has the default `Makefile` value of `v0.0.0`.
|
||||
|
||||
|
||||
|
||||
### `clean.sh`: Cleanup
|
||||
|
||||
Optional environment:
|
||||
|
@ -75,6 +85,8 @@ Optional environment:
|
|||
Required environment:
|
||||
* `DIST_DIR`: the directory where a release has previously been built.
|
||||
|
||||
|
||||
|
||||
### `go-build.sh`: Build The Backend
|
||||
|
||||
Optional environment:
|
||||
|
@ -95,6 +107,8 @@ Optional environment:
|
|||
Required environment:
|
||||
* `CHANNEL`: release channel, see above.
|
||||
|
||||
|
||||
|
||||
### `go-deps.sh`: Install Backend Dependencies
|
||||
|
||||
Optional environment:
|
||||
|
@ -103,6 +117,8 @@ Optional environment:
|
|||
Go package that is processed. `2` also shows subcommands and environment.
|
||||
The default value is `0`, don't be verbose.
|
||||
|
||||
|
||||
|
||||
### `go-lint.sh`: Run Backend Static Analyzers
|
||||
|
||||
Don't forget to run `make go-tools` once first!
|
||||
|
@ -114,6 +130,8 @@ Optional environment:
|
|||
* `VERBOSE`: verbosity level. `1` shows every command that is run. `2` also
|
||||
shows subcommands. The default value is `0`, don't be verbose.
|
||||
|
||||
|
||||
|
||||
### `go-test.sh`: Run Backend Tests
|
||||
|
||||
Optional environment:
|
||||
|
@ -126,6 +144,8 @@ Optional environment:
|
|||
Go package that is processed. `2` also shows subcommands. The default
|
||||
value is `0`, don't be verbose.
|
||||
|
||||
|
||||
|
||||
### `go-tools.sh`: Install Backend Tooling
|
||||
|
||||
Installs the Go static analysis and other tools into `${PWD}/bin`. Either add
|
||||
|
@ -135,16 +155,22 @@ directly, or use the commands through `make` (for example, `make go-lint`).
|
|||
Optional environment:
|
||||
* `GO`: set an alternative name for the Go compiler.
|
||||
|
||||
|
||||
|
||||
### `version.sh`: Generate And Print The Current Version
|
||||
|
||||
Required environment:
|
||||
* `CHANNEL`: release channel, see above.
|
||||
|
||||
|
||||
|
||||
## `snap/`: Snap GUI Files
|
||||
|
||||
App icons (see https://github.com/AdguardTeam/AdGuardHome/pull/1836), Snap
|
||||
manifest file templates, and helper scripts.
|
||||
|
||||
|
||||
|
||||
## `translations/`: Twosky Integration Script
|
||||
|
||||
### Usage
|
||||
|
@ -158,6 +184,12 @@ manifest file templates, and helper scripts.
|
|||
After the download you'll find the output locales in the `client/src/__locales/`
|
||||
directory.
|
||||
|
||||
Optional environment:
|
||||
* `UPLOAD_LANGUAGE`: set an alternative language for `locales:upload` to
|
||||
upload.
|
||||
|
||||
|
||||
|
||||
## `whotracksme/`: Whotracks.me Database Converter
|
||||
|
||||
A simple script that converts the Ghostery/Cliqz trackers database to a json format.
|
||||
|
|
|
@ -3,7 +3,7 @@ const fs = require('fs');
|
|||
const request = require('request-promise');
|
||||
const twoskyConfig = require('../../.twosky.json')[0];
|
||||
|
||||
const { project_id: TWOSKY_PROJECT_ID, base_locale: LANGUAGE } = twoskyConfig;
|
||||
const { project_id: TWOSKY_PROJECT_ID, base_locale: DEFAULT_LANGUAGE } = twoskyConfig;
|
||||
const LOCALES_DIR = '../../client/src/__locales';
|
||||
const BASE_FILE = 'en.json';
|
||||
const TWOSKY_URI = process.env.TWOSKY_URI;
|
||||
|
@ -12,14 +12,17 @@ const TWOSKY_URI = process.env.TWOSKY_URI;
|
|||
* Prepare post params
|
||||
*/
|
||||
const getRequestData = (url, projectId) => {
|
||||
const language = process.env.UPLOAD_LANGUAGE || DEFAULT_LANGUAGE;
|
||||
const formData = {
|
||||
format: 'json',
|
||||
language: LANGUAGE,
|
||||
language: language,
|
||||
filename: BASE_FILE,
|
||||
project: projectId,
|
||||
file: fs.createReadStream(path.resolve(LOCALES_DIR, `${LANGUAGE}.json`)),
|
||||
file: fs.createReadStream(path.resolve(LOCALES_DIR, `${language}.json`)),
|
||||
};
|
||||
|
||||
console.log(`uploading ${language}`);
|
||||
|
||||
return {
|
||||
url: `${url}/upload`,
|
||||
formData
|
||||
|
|
Loading…
Reference in New Issue