Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/multi-arch
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeyBG committed Feb 7, 2024
2 parents e007fb2 + c0c782f commit da8ca13
Show file tree
Hide file tree
Showing 248 changed files with 4,103 additions and 2,090 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
env:
POSTGRES_DB: accent_test
POSTGRES_PASSWORD: password
ports: ["5432:5432"]
ports: ['5432:5432']
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

env:
Expand Down Expand Up @@ -109,6 +109,8 @@ jobs:
type=semver,pattern={{raw}}
- uses: docker/build-push-action@v5
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
platforms: linux/amd64,linux/arm64
push: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' }}
Expand Down
6 changes: 3 additions & 3 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
elixir 1.15.6-otp-25
erlang 25.0.2
nodejs 16.15.1
elixir 1.15.7-otp-26
erlang 26.1.2
nodejs 16.19.1
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@ RUN apt-get update -y && \
rm -f /var/lib/apt/lists/*_*

COPY priv priv
COPY vendor vendor

RUN cd ./vendor/language_tool/priv/native/languagetool && ./gradlew shadowJar
RUN cp ./vendor/language_tool/priv/native/languagetool/app/build/libs/language-tool.jar priv/native/language-tool.jar

RUN mix local.rebar --force && \
mix local.hex --force

COPY mix.* ./
COPY lib lib
COPY config config
COPY mix.exs .
COPY mix.lock .

RUN mix deps.get --only prod
RUN mix deps.compile --only prod

COPY vendor vendor
RUN cd ./vendor/language_tool/priv/native/languagetool && ./gradlew shadowJar
RUN cp ./vendor/language_tool/priv/native/languagetool/app/build/libs/language-tool.jar priv/native/language-tool.jar

COPY lib lib

RUN mix compile --only prod

# Move static assets from other stages into the OTP release.
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ This will start the webserver on port 4000, migrate the database to have an up a

## 🚧 Requirements

- `erlang ~> 24.0`
- `elixir ~> 1.13`
- `erlang ~> 26.1`
- `elixir ~> 1.15`
- `postgres >= 9.4`
- `node.js >= 16.13`
- `node.js >= 16.19`
- `libyaml >= 0.1.7`

## 🎛 Executing mix commands
Expand Down Expand Up @@ -203,7 +203,7 @@ Accent provides a default value for every required environment variable. This me

```shell
$ npm --prefix webapp run build
$ mix run ./priv/repo/seeds.exs
$ mix ecto.setup
$ mix test
```

Expand All @@ -230,8 +230,8 @@ $> heroku addons:create heroku-postgresql:hobby-dev --app peaceful-badlands-8588
Creating heroku-postgresql:hobby-dev on ⬢ peaceful-badlands-85887... free
Database has been created and is available
$> heroku config:set FORCE_SSL=true DUMMY_LOGIN_ENABLED=true --app peaceful-badlands-85887
Setting FORCE_SSL, DUMMY_LOGIN_ENABLED and restarting ⬢ peaceful-badlands-85887... done
$> heroku config:set FORCE_SSL=true DATABASE_SSL=true DUMMY_LOGIN_ENABLED=true --app peaceful-badlands-85887
Setting FORCE_SSL, DATABASE_SSL, DUMMY_LOGIN_ENABLED and restarting ⬢ peaceful-badlands-85887... done
$> heroku container:push web --app peaceful-badlands-85887
=== Building web
Expand Down
5 changes: 5 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
"description": "The default login to quickly test the instance. It only requires the user to enter a valid email to login.",
"value": "true",
"required": false
},
"DATABASE_SSL": {
"description": "Indicates that SSL is required for the database connection.",
"value": "true",
"required": false
}
},
"addons": [
Expand Down
71 changes: 61 additions & 10 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $ npm install -g accent-cli
$ accent COMMAND
running command...
$ accent (-v|--version|version)
accent-cli/0.14.1 darwin-arm64 node-v16.15.1
accent-cli/0.16.0 darwin-arm64 node-v16.19.1
$ accent --help [COMMAND]
USAGE
$ accent COMMAND
Expand All @@ -38,6 +38,9 @@ accent-cli reads from a `accent.json` file. The file should contain valid JSON r
{
"apiUrl": "http://your.accent.instance",
"apiKey": "2nziVSaa8yUJxLkwoZA",
"version": {
"branchVersionPrefix": "release/"
}
"files": [
{
"format": "json",
Expand Down Expand Up @@ -65,6 +68,10 @@ Available ENV variables. (Each variable will override `accent.json` variables if
- `ACCENT_API_URL`: Api Key to your Accent Instance
- `ACCENT_PROJECT`: Your Project uuid

Version object configuration

- `branchVersionPrefix`: The Git branch prefix use to extract the file version

Each operation section `sync` and `addTranslations` can contain the following object:

- `language`: The identifier of the document’s language
Expand Down Expand Up @@ -121,6 +128,36 @@ Each operation section `sync` and `addTranslations` can contain the following ob
}
```

`fileWithParentDirectory`: Use the path of the file in addition to the file name. This is useful if you want to keep your file in multiple nested directories, per language. Use the position of the `%slug%` placeholder in the `target` as the root of the path.

```
{
"files": [
{
"namePattern": "fileWithParentDirectory",
"source": "translations/en/**/*.json",
"target": "translations/%slug%/%document_path%.json",
}
]
}
```

Given this configuration and a file layout like this:

```
my-project/
accent.json
translations/
en/
foo/
locales.json
fr/
foo/
locales.json
```

The document name in Accent will be named `foo/locales`.

## Hooks

Here is a list of available hooks. Those are self-explanatory
Expand All @@ -130,6 +167,18 @@ Here is a list of available hooks. Those are self-explanatory
- `beforeExport`
- `afterExport`

## Version

Version can be extracted from the current Git branch name.

```
"version": {
"branchVersionPrefix": "release/"
}
```

Naming a branch `release/v1.0.0` will cause the `sync` and `stats` CLI commands to be invoked as if `--version=1.0.0` had been specified.

# Commands
<!-- commands -->
* [`accent export`](#accent-export)
Expand Down Expand Up @@ -158,7 +207,7 @@ EXAMPLES
$ accent export --order-by=key --version=build.myapp.com:0.12.345
```

_See code: [src/commands/export.ts](https://github.com/mirego/accent/blob/v0.14.1/src/commands/export.ts)_
_See code: [src/commands/export.ts](https://github.com/mirego/accent/blob/v0.16.0/src/commands/export.ts)_

## `accent format`

Expand All @@ -176,7 +225,7 @@ EXAMPLE
$ accent format
```

_See code: [src/commands/format.ts](https://github.com/mirego/accent/blob/v0.14.1/src/commands/format.ts)_
_See code: [src/commands/format.ts](https://github.com/mirego/accent/blob/v0.16.0/src/commands/format.ts)_

## `accent help [COMMAND]`

Expand Down Expand Up @@ -213,7 +262,7 @@ EXAMPLE
$ accent jipt
```

_See code: [src/commands/jipt.ts](https://github.com/mirego/accent/blob/v0.14.1/src/commands/jipt.ts)_
_See code: [src/commands/jipt.ts](https://github.com/mirego/accent/blob/v0.16.0/src/commands/jipt.ts)_

## `accent lint`

Expand All @@ -230,24 +279,27 @@ EXAMPLE
$ accent lint
```

_See code: [src/commands/lint.ts](https://github.com/mirego/accent/blob/v0.14.1/src/commands/lint.ts)_
_See code: [src/commands/lint.ts](https://github.com/mirego/accent/blob/v0.16.0/src/commands/lint.ts)_

## `accent stats`

Fetch stats from the API and display it beautifully
Fetch stats from the API and display them beautifully

```
USAGE
$ accent stats
OPTIONS
--config=config [default: accent.json] Path to the config file
--check-reviewed Exit 1 when reviewed percentage is not 100%
--check-translated Exit 1 when translated percentage is not 100%
--config=config [default: accent.json] Path to the config file
--version=version View stats for a specific version
EXAMPLE
$ accent stats
```

_See code: [src/commands/stats.ts](https://github.com/mirego/accent/blob/v0.14.1/src/commands/stats.ts)_
_See code: [src/commands/stats.ts](https://github.com/mirego/accent/blob/v0.16.0/src/commands/stats.ts)_

## `accent sync`

Expand Down Expand Up @@ -279,7 +331,7 @@ EXAMPLES
$ accent sync --add-translations --merge-type=smart --order-key=key --version=v0.23
```

_See code: [src/commands/sync.ts](https://github.com/mirego/accent/blob/v0.14.1/src/commands/sync.ts)_
_See code: [src/commands/sync.ts](https://github.com/mirego/accent/blob/v0.16.0/src/commands/sync.ts)_
<!-- commandsstop -->

# GitHub Actions
Expand Down Expand Up @@ -323,7 +375,6 @@ In this example the translations will be synchronized daily at midnight eastern
# License
`accent-cli` is © 2019 [Mirego](http://www.mirego.com) and may be freely distributed under the [New BSD license](http://opensource.org/licenses/BSD-3-Clause). See the [`LICENSE.md`](https://github.com/mirego/accent-cli/blob/master/LICENSE.md) file.

# About Mirego

[Mirego](http://mirego.com) is a team of passionate people who believe that work is a place where you can innovate and have fun. We’re a team of [talented people](http://life.mirego.com) who imagine and build beautiful Web and mobile applications. We come together to share ideas and [change the world](http://mirego.org).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"key" = "value";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"key" = "valeur";
10 changes: 10 additions & 0 deletions cli/examples/dot-in-slug-directory/accent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"files": [
{
"namePattern": "file",
"format": "strings",
"source": "Project/Resources/en.lproj/Localizable.strings",
"target": "Project/Resources/%slug%.lproj/%document_path%.strings"
}
]
}
10 changes: 10 additions & 0 deletions cli/examples/nested-per-language/accent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"files": [
{
"namePattern": "fileWithParentDirectory",
"format": "json",
"source": "nested/fr/**/*.json",
"target": "nested/%slug%/%document_path%.json"
}
]
}
3 changes: 3 additions & 0 deletions cli/examples/nested-per-language/nested/fr/admin/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"key": "value"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"key": "value"
}
3 changes: 3 additions & 0 deletions cli/examples/nested-per-language/nested/fr/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"key": "value"
}
5 changes: 4 additions & 1 deletion cli/examples/simple/accent.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"source": "localization.json",
"target": "%document_path%.json"
}
]
],
"version": {
"branchVersionPrefix": "release/"
}
}
2 changes: 1 addition & 1 deletion cli/package-lock.json

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

2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "accent-cli",
"version": "0.14.1",
"version": "0.16.0",
"author": "Simon Prévost",
"description": "Accent CLI",
"bin": {
Expand Down
Loading

0 comments on commit da8ca13

Please sign in to comment.