Skip to content

Commit

Permalink
Merge pull request #25 from curiosum-dev/release/0.2.0
Browse files Browse the repository at this point in the history
Release/0.2.0
  • Loading branch information
arturz authored Sep 4, 2023
2 parents a86a741 + ede364c commit fa096a8
Show file tree
Hide file tree
Showing 103 changed files with 1,846 additions and 607 deletions.
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_url "https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6dee421cfd0f51481d17f77586997/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0="

use devenv
61 changes: 61 additions & 0 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Kanta Development

on:
push:
branches: ["develop"]
pull_request:
branches: ["develop"]

env:
MIX_ENV: dev

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
name: Test on OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
strategy:
matrix:
otp: ["25.0.4"]
elixir: ["1.14.1"]
steps:
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
- name: Checkout code
uses: actions/checkout@v3
- name: Cache deps
id: cache-deps
uses: actions/cache@v3
env:
cache-name: cache-elixir-deps
with:
path: deps
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
- name: Cache compiled build
id: cache-build
uses: actions/cache@v3
env:
cache-name: cache-compiled-build
with:
path: _build
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
${{ runner.os }}-mix-
- name: Install dependencies
run: mix deps.get
- name: Compiles without warnings
run: mix compile --warnings-as-errors
- name: Check Formatting
run: mix format --check-formatted
- name: Run credo
run: mix credo
- name: "Run dialyzer"
run: mix dialyzer -Wno_match --format short 2>&1
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# The directory Mix will write compiled artifacts to.
/_build/

# If you run "mix dialyzer", PLT files will be written to this directory.
/.dialyzer/

# If you run "mix test --cover", coverage assets end up here.
/cover/

Expand All @@ -26,4 +29,10 @@ kanta-*.tar
/tmp/
/assets/node_modules
/assets/.DS_Store
/.DS_Store
/.DS_Store
/.devenv.flake.nix
/.devenv/
/.direnv/
/.nix-mix/
/.nix-hex/
.DS_Store
1 change: 1 addition & 0 deletions .lefthook/commit-msg/commitlint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
echo $(head -n1 $1) | npx commitlint --color
32 changes: 20 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<p style="margin-top: 3rem; font-size: 14pt;" align="center">
User-friendly translations manager for Elixir/Phoenix projects.
<br />
<a href="https://kanta.munasoft.pl">View Demo</a>
<a href="https://kanta.curiosum.com">View Demo</a>
·
<a href="https://github.com/curiosum-dev/kanta/issues">Report Bug</a>
·
Expand Down Expand Up @@ -78,8 +78,8 @@ by adding `kanta` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:kanta, "~> 0.1.0"},
{:gettext, git: "[email protected]:bamorim/gettext.git", branch: "runtime-gettext"}
{:kanta, "~> 0.1.1"},
{:gettext, git: "[email protected]:ravensiris/gettext.git", branch: "runtime-gettext"}
]
end
```
Expand All @@ -92,10 +92,10 @@ Add to `config/config.exs` file:

```elixir
# config/config.exs
config :kanta,
endpoint: KantaTestWeb.Endpoint, # Your app Endpoint module
repo: KantaTest.Repo, # Your app Repo module
project_root: File.cwd!(), # Project root directory
config :my_app, Kanta,
endpoint: MyAppWeb.Endpoint, # Your app Endpoint module
repo: MyApp.Repo, # Your app Repo module
otp_name: :my_app, # Name of your OTP app
plugins: []
```

Expand All @@ -116,11 +116,11 @@ defmodule MyApp.Repo.Migrations.AddKantaTranslationsTable do
use Ecto.Migration

def up do
Kanta.Migration.up(version: 1)
Kanta.Migration.up(version: 1, prefix: prefix()) # Prefix is needed if you are using multitenancy with i.e. triplex
end

def down do
Kanta.Migration.down(version: 1)
Kanta.Migration.down(version: 1, prefix: prefix()) # Prefix is needed if you are using multitenancy with i.e. triplex
end
end
```
Expand All @@ -147,7 +147,7 @@ In the `application.ex` file of our project, we add Kanta and its configuration
def start(_type, _args) do
children = [
...
{Kanta, Application.fetch_env!(:kanta_test, Kanta)}
{Kanta, Application.fetch_env!(:my_app, Kanta)}
...
]
...
Expand Down Expand Up @@ -207,16 +207,24 @@ config :kanta,

## DeepL

Not all of us are polyglots, and sometimes we need the help of machine translation tools. For this reason, we have provided plug-ins for communication with external services that will allow you to translate texts into another language without knowing it. As a first step, we introduced integration with DeepL API offering 500,000 characters/month for free and more in paid plans. To use DeepL API add `Kanta.Plugins.DeepL` to the list of plugins along with the API key from your account at DeepL. New features will then be added to the Kanta UI that will allow you to translate using this tool.
Not all of us are polyglots, and sometimes we need the help of machine translation tools. For this reason, we have provided plug-ins for communication with external services that will allow you to translate texts into another language without knowing it. As a first step, we introduced integration with DeepL API offering 500,000 characters/month for free and more in paid plans. To use DeepL API add `{:kanta_deep_l_plugin, "~> 0.1.0"}` to your `deps` and append `Kanta.DeepL.Plugin` to the list of plugins along with the API key from your account at DeepL. New features will then be added to the Kanta UI that will allow you to translate using this tool.

<img style="margin-top: 1rem; margin-bottom: 1rem;" src="./plural.png" alt="plural">

```elixir
# mix.exs
defp deps
...
{:kanta_deep_l_plugin, "~> 0.1.0"}
end
```

```elixir
# config/config.exs
config :kanta,
...
plugins: [
{Kanta.Plugins.DeepL, api_key: "YOUR_DEEPL_API_KEY"}
{Kanta.DeepL.Plugin, api_key: "YOUR_DEEPL_API_KEY"}
]
```

Expand Down
5 changes: 1 addition & 4 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ import Config
config :kanta, Kanta.Cache,
primary: [
gc_interval: :timer.hours(24),
backend: :shards,
partitions: 2
backend: :shards
]

config :tesla, :adapter, {Tesla.Adapter.Finch, name: Kanta.Finch}

config :phoenix, :json_library, Jason
config :phoenix, :stacktrace_depth, 20

Expand Down
156 changes: 156 additions & 0 deletions devenv.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1688664806,
"narHash": "sha256-MCdKM7iZYN5d29uvbIHi/kzsLmTKGSKF+d3+9R2A+hk=",
"owner": "cachix",
"repo": "devenv",
"rev": "70d8ee2698a1378ebef1e29075995b04c056f7c7",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1660459072,
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1688646010,
"narHash": "sha256-kCeza5eKI2NEi8k0EoeZfv3lN1r1Vwx+L/VA6I8tmG4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5daaa32204e9c46b05cd709218b7ba733d07e80c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1685801374,
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1688596063,
"narHash": "sha256-9t7RxBiKWHygsqXtiNATTJt4lim/oSYZV3RG8OjDDng=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "c8d18ba345730019c3faf412c96a045ade171895",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
34 changes: 34 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{pkgs, ...}: let
erlang = pkgs.beam.packages.erlangR25;
nodejs = pkgs.nodejs_20;
elixir = erlang.elixir_1_14;
elixir-ls = erlang.elixir-ls.override {elixir = erlang.elixir_1_14;};
in {
env.LANG = "en_US.UTF-8";
env.ERL_AFLAGS = "-kernel shell_history enabled";

enterShell = ''
export MIX_HOME=$PWD/.nix-mix
export HEX_HOME=$PWD/.nix-hex
export PATH=$MIX_HOME/bin:$PATH
export PATH=$HEX_HOME/bin:$PATH
export PATH=$PATH:$(pwd)/_build/pip_packages/bin
'';

packages =
(with pkgs; [
inotify-tools
alejandra
])
++ [nodejs elixir-ls];

languages.elixir = {
enable = true;
package = elixir;
};

languages.javascript = {
enable = true;
package = nodejs;
};
}
3 changes: 3 additions & 0 deletions devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
inputs:
nixpkgs:
url: github:NixOS/nixpkgs/nixpkgs-unstable
2 changes: 1 addition & 1 deletion dist/css/app.css

Large diffs are not rendered by default.

Binary file added docs/assets/images/dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/form-component.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit fa096a8

Please sign in to comment.