Kanta

User-friendly translations manager for Elixir/Phoenix projects. Simplify the process of managing translations by providing an intuitive interface for adding, editing, and deleting translations with live UI integration.

Translation management for Elixir/Phoenix
PO Writer plugin for Kanta. Generate PO files from Kanta translations.
Synchronize translations between development, staging, and production environments.
DeepL translation integration for Kanta.

Cheatsheet

Quick reference for installation, configuration, and usage of Kanta.

Add to mix.exs
Installation

def deps do
  [
    {:kanta, "~> 0.4.2"},
    {:gettext, git: "git@github.com:ravensiris/gettext.git", branch: "runtime-gettext"}
  ]
end
                  
Run migration command
Installation

mix ecto.gen.migration add_kanta_translations_table
                  
Configuration in config.exs
Configuration

# config/config.exs
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: []
                  
Database migration setup
Configuration

defmodule MyApp.Repo.Migrations.AddKantaTranslationsTable do
  use Ecto.Migration

  def up do
    Kanta.Migration.up(version: 3)
  end

  def down do
    Kanta.Migration.down(version: 3)
  end
end
                  
Gettext module configuration
Configuration

defmodule MyAppWeb.Gettext do
  use Gettext, otp_app: :kanta_landing, repo: KantaLandingWeb.GettextRepo
end
                  
Add to application supervision tree
Setup

# application.ex
def start(_type, _args) do
  children = [
    ...
    {Kanta, Application.fetch_env!(:my_app, Kanta)}
    ...
  ]
  ...
end
                  
Add routes for Kanta UI
Setup

# router.ex
import KantaWeb.Router

scope "/" do
  pipe_through :browser

  kanta_dashboard("/kanta")
end
                  
DeepL integration
Plugin

# Add to deps in mix.exs
{:kanta_deep_l_plugin, "~> 0.1.1"}

# Configure in config.exs
config :kanta,
  plugins: [
    {Kanta.DeepL.Plugin, api_key: "YOUR_DEEPL_API_KEY"}
  ]
                  
PO Writer plugin
Plugin

# Add to deps in mix.exs
{:kanta_po_writer_plugin, git: "https://github.com/curiosum-dev/kanta_po_writer_plugin"}

# Configure in config.exs
config :kanta,
  plugins: [
    Kanta.POWriter.Plugin
  ]
                  
KantaSync plugin - Dependencies & Migration
Plugin

# Add to deps in mix.exs
{:kanta_sync_plugin, "~> 0.1.0"}

# Create migration file
defmodule MyApp.Repo.Migrations.AddKantaSyncTables do
  use Ecto.Migration

  def up do
    Kanta.Sync.Migration.up(version: 1)
  end

  def down do
    Kanta.Sync.Migration.down(version: 1)
  end
end
                  
KantaSync plugin - Configuration & Environment
Plugin

# Add API routes in router.ex
scope "/" do
  kanta_api("/kanta-api")
end

# Environment variables (required)
KANTA_API_ENDPOINT="https://production-app.com/kanta-api"
KANTA_SECRET_TOKEN="$(mix phx.gen.secret 256)"

# Optional: Disable default authorization
config :kanta,
  disable_api_authorization: true
                  

Features

  • Extract from PO files

    Automatically analyzes .po files and converts them to database format for convenient use.

  • Database storage

    Messages and translations are stored in database tables for easy viewing and modification.

  • Translation progress

    Track translation progress across languages with visual dashboard and filtering options.

  • User-friendly UI

    Intuitive web interface for adding, editing, and deleting translations with live updates.

  • DeepL integration

    Machine translation support with DeepL API for quick translation assistance.

  • Environment sync

    Synchronize translations between development, staging, and production environments.

Kanta's development depends on you.

We invite you to discuss, contribute and share Kanta with others.

Support Kanta

Slack channel

Join #kanta to ask questions and share feedback.

GitHub Discussions

Open-ended conversations about features and usage.

GitHub Issues

Report bugs and request features.

Contributing guide

How to set up, code and submit contributions.

Join our Discord server

Hang out with the Curiosum community.

Spread the word

Share Kanta with your network.