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