Logo

User-friendly translations manager for Elixir/Phoenix projects.
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

kanta-ui

TODO

(back to top)

Getting Started

Prerequisites

Installation

The package can be installed by adding kanta to your list of dependencies in mix.exs:

def deps do
[
{:kanta, "~> 0.1.0"},
{:gettext, git: "git@github.com:bamorim/gettext.git", branch: "runtime-gettext"}
]
end

The dependency on this specific gettext version is because this library depends on an in-progress feature, to be included in a future release of gettext (see discussion in elixir-gettext/gettext#280 and pull request elixir-gettext/gettext#305). As of March 2023, this has been approved by an Elixir core team member, so we are eagerly awaiting for it being merged upstream.

Add configuration

Add to config/config.exs file:

# config/config.exs
config :kanta,
ecto_repo: MyApp.Repo,
project_root: File.cwd!()

Ecto repo is used for translations persistency.

Create migration

Create migration with

mix ecto.gen.migration add_kanta_translations_table

Open the generated migration file and set up up and down functions:

defmodule MyApp.Repo.Migrations.AddKantaTranslationsTable do
use Ecto.Migration
def up do
Kanta.Migrations.up()
end
def down do
Kanta.Migrations.down()
end
end

And run

mix ecto.migrate

Adjust Gettext module

Add Kanta Repo as a default translation repository inside your Gettext module.

use Gettext, ..., repo: Kanta.Gettext.Repo

Setup Kanta UI

Inside your router.ex file forward desired path to the KantaWeb.Router.

scope "/" do
  pipe_through :browser
  forward "/kanta", KantaWeb.Router
end

(back to top)

Usage

  1. Start Phoenix server and visit localhost:4000/kanta (or otherpath you've set in the router.ex file).
  2. From there you can check and modify your translations from already existing .po files.

TODO

(back to top)

Roadmap

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. We prefer gitflow and Conventional ommits style but we don't require that. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'feat: Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Michał Buszkiewicz - michal@curiosum.com

Krzysztof Janiec - krzysztof.janiec@curiosum.com

Artur Ziętkiewicz - artur.zietkiewicz@curiosum.com

(back to top)