-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from curiosum-dev/release/0.3.1
Release/0.3.1
- Loading branch information
Showing
26 changed files
with
466 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,7 +102,7 @@ by adding `kanta` to your list of dependencies in `mix.exs`: | |
```elixir | ||
def deps do | ||
[ | ||
{:kanta, "~> 0.3.0"}, | ||
{:kanta, "~> 0.3.1"}, | ||
{:gettext, git: "[email protected]:ravensiris/gettext.git", branch: "runtime-gettext"} | ||
] | ||
end | ||
|
@@ -180,9 +180,9 @@ In the `application.ex` file of our project, we add Kanta and its configuration | |
|
||
## Kanta UI | ||
|
||
Inside your `router.ex` file we need to connect the Kanta panel using the kanta_dashboard macro. | ||
Inside your `router.ex` file we need to connect the Kanta panel using the kanta_dashboard macro. | ||
|
||
```elixir | ||
```elixir | ||
import KantaWeb.Router | ||
|
||
scope "/" do | ||
|
@@ -226,7 +226,7 @@ Not all of us are polyglots, and sometimes we need the help of machine translati | |
|
||
```elixir | ||
# mix.exs | ||
defp deps | ||
defp deps do | ||
... | ||
{:kanta_deep_l_plugin, "~> 0.1.1"} | ||
end | ||
|
@@ -241,6 +241,35 @@ config :kanta, | |
] | ||
``` | ||
|
||
## KantaSync | ||
|
||
The [KantaSync plugin](https://github.com/curiosum-dev/kanta_sync_plugin) allows you to synchronize translations between your production and staging/dev environments. It ensures that any changes made to translations in one are reflected in the others, helping you maintain consistency across different stages of development. | ||
|
||
```elixir | ||
# mix.exs | ||
defp deps do | ||
... | ||
{:kanta_sync_plugin, "~> 0.1.0"} | ||
end | ||
``` | ||
|
||
You need to have Kanta API configured by using kanta_api macro. | ||
|
||
```elixir | ||
# router.ex | ||
import KantaWeb.Router | ||
|
||
scope "/" do | ||
kanta_api("/kanta-api") | ||
end | ||
``` | ||
|
||
### Authorization | ||
|
||
Set `KANTA_SECRET_TOKEN` environment variable for restricting API access. It should be generated with `mix phx.gen.secret 256` and both environments must have the same `KANTA_SECRET_TOKEN` environment variables. | ||
|
||
You can also disable default authorization mechanism and use your own, by passing `disable_api_authorization: true` option into Kanta's config. | ||
|
||
## PO Writer | ||
|
||
Kanta was created to allow easy management of static text translations in the application, however, for various reasons like wanting a backup or parallel use of other tools like TMS etc. you may want to overwrite .po files with translations entered in Kanta. To install it append `{:kanta_po_writer_plugin, git: "https://github.com/curiosum-dev/kanta_po_writer_plugin"}` to your `deps` list. Currently, it's not on Hex because it's in a pre-release version. Then add `Kanta.Plugins.POWriter` to the list of plugins, and new functions will appear in the Kanta UI to allow writing to .po files. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
defmodule Kanta.Specs.SchemataSpec do | ||
@moduledoc false | ||
|
||
@type schema() :: {String.t(), %{schema: atom(), conflict_target: atom() | [atom()]}} | ||
|
||
@type t() :: [schema()] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
lib/kanta/translations/plural_translation/finders/list_translated_plural_translations.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
defmodule Kanta.Translations.PluralTranslations.Finders.ListTranslatedPluralTranslations do | ||
@moduledoc """ | ||
Query module aka Finder responsible for listing translated plural translations | ||
""" | ||
|
||
use Kanta.Query, | ||
module: Kanta.Translations.PluralTranslation, | ||
binding: :plural_translation | ||
|
||
alias Kanta.Repo | ||
|
||
def find do | ||
base() | ||
|> translated_query() | ||
|> Repo.get_repo().all() | ||
end | ||
|
||
defp translated_query(query) do | ||
from(pt in query, | ||
where: not is_nil(pt.translated_text) and pt.translated_text != "" | ||
) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
lib/kanta/translations/singular_translation/finders/list_translated_singular_translations.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
defmodule Kanta.Translations.SingularTranslations.Finders.ListTranslatedSingularTranslations do | ||
@moduledoc """ | ||
Query module aka Finder responsible for listing translated singular translations | ||
""" | ||
|
||
use Kanta.Query, | ||
module: Kanta.Translations.SingularTranslation, | ||
binding: :singular_translation | ||
|
||
alias Kanta.Repo | ||
|
||
def find do | ||
base() | ||
|> translated_query() | ||
|> Repo.get_repo().all() | ||
end | ||
|
||
defp translated_query(query) do | ||
from(st in query, | ||
where: not is_nil(st.translated_text) and st.translated_text != "" | ||
) | ||
end | ||
end |
Oops, something went wrong.