From 79b8cf984c0c10934666b1461792757f117dad10 Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Thu, 26 Nov 2026 13:47:29 -0800 Subject: [PATCH] feat(i18n): add Bosnian, Croatian, and Serbian localizations Expand CommitKit localization support from 45 to 48 languages by adding Bosnian (bs), Croatian (hr), and Serbian (sr, Cyrillic) static catalogs (67 keys each), BCP-47 tag parsing (bs-BA, hr-HR, sr-RS, sr-Cyrl, sr-Latn), distinctness tests, localized READMEs, and root README switcher updates. Signed-off-by: Thomas Vincent --- README.md | 3 +- docs/i18n/bs/README.md | 237 +++++++++++++++++++++++++++++++++++++++++ docs/i18n/hr/README.md | 237 +++++++++++++++++++++++++++++++++++++++++ docs/i18n/sr/README.md | 237 +++++++++++++++++++++++++++++++++++++++++ src/i18n/catalog.rs | 223 +++++++++++++++++++++++++++++++++++++- src/i18n/mod.rs | 57 ++++++++-- 6 files changed, 986 insertions(+), 8 deletions(-) create mode 100644 docs/i18n/bs/README.md create mode 100644 docs/i18n/hr/README.md create mode 100644 docs/i18n/sr/README.md diff --git a/README.md b/README.md index c096509..dd3eafe 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ OPTIONS: ### Supported Languages -CommitKit detects the display language from `LC_ALL`, `LC_MESSAGES`, and `LANG`, or accepts `--lang `. It supports 45 languages (including 6 right-to-left locales: `ar`, `ar-EG`, `ar-MA`, `fa`, `he`, and `ur`): +CommitKit detects the display language from `LC_ALL`, `LC_MESSAGES`, and `LANG`, or accepts `--lang `. It supports 48 languages (including 6 right-to-left locales: `ar`, `ar-EG`, `ar-MA`, `fa`, `he`, and `ur`): | Code | Language | README | Code | Language | README | Code | Language | README | | --- | --- | --- | --- | --- | --- | --- | --- | --- | @@ -95,6 +95,7 @@ CommitKit detects the display language from `LC_ALL`, `LC_MESSAGES`, and `LANG`, | `zh-TW` | 繁體中文 | [README](docs/i18n/zh-TW/README.md) | `ig-NG` | Igbo | [README](docs/i18n/ig-NG/README.md) | `ur` | اردو | [README](docs/i18n/ur/README.md) | | `ar` | العربية | [README](docs/i18n/ar/README.md) | `mg-MG` | Malagasy | [README](docs/i18n/mg-MG/README.md) | `ms` | Bahasa Melayu | [README](docs/i18n/ms/README.md) | | `hi` | हिन्दी | [README](docs/i18n/hi/README.md) | `rw-RW` | Kinyarwanda | [README](docs/i18n/rw-RW/README.md) | `fil` | Filipino | [README](docs/i18n/fil/README.md) | +| `bs` | Bosanski | [README](docs/i18n/bs/README.md) | `hr` | Hrvatski | [README](docs/i18n/hr/README.md) | `sr` | Српски | [README](docs/i18n/sr/README.md) | ### Interactive process diff --git a/docs/i18n/bs/README.md b/docs/i18n/bs/README.md new file mode 100644 index 0000000..e5d0508 --- /dev/null +++ b/docs/i18n/bs/README.md @@ -0,0 +1,237 @@ +[English](../../../README.md) + +# CommitKit + +[![CI](https://github.com/somethingwithproof/commitkit-rust/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/somethingwithproof/commitkit-rust/actions/workflows/ci.yml) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=somethingwithproof_commitkit-rust&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=somethingwithproof_commitkit-rust) +[![Release](https://img.shields.io/github/v/release/somethingwithproof/commitkit-rust)](https://github.com/somethingwithproof/commitkit-rust/releases) +[![Rust minimum](https://img.shields.io/badge/Rust_minimum-1.88.0-blue)](../../../Cargo.toml) +[![License](https://img.shields.io/badge/license-MIT-blue)](../../../LICENSE) +[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/somethingwithproof/commitkit-rust/badge)](https://scorecard.dev/viewer/?uri=github.com/somethingwithproof/commitkit-rust) + +CommitKit je alat za komandnu liniju koji pomaže programerima da pišu dobro strukturirane i dosljedne commit poruke prema specifikaciji [Conventional Commits](https://www.conventionalcommits.org/). Pruža interaktivni interfejs koji vodi korisnike kroz sastavljanje commit poruke s tipom, opcionalnim opsegom, naslovom, tijelom i podnožjem. + +## Mogućnosti + +- **Osnovne funkcionalnosti** + - Interaktivni odabir tipova commita i opsega + - Prilagodljive postavke putem datoteke `.commitkit.toml` + - Kontrola maksimalne dužine naslova + - Podrška za višeredna tijela commita + - Automatska provjera unosa + - Opcionalna `Signed-off-by` linija u commitovima + - Višeplatformska kompatibilnost + +- **Napredne mogućnosti** + - Podrška za emoji u commit porukama (✨, 🐛 itd.) + - Šabloni za commit sa zamjenom parametara + - Automatsko generisanje i održavanje dnevnika promjena + - Git hookovi za provjeru i formatiranje commit poruka + - Statistika i analiza commitova + - Interaktivni upiti za vrijednosti u šablonima + +## Preduslovi + +- **Rust**: verzija 1.88.0 ili novija (MSRV) +- **Cargo**: uključen uz instalaciju Rusta + +## Instalacija + +### Iz izvornog koda + +```shell +git clone https://github.com/somethingwithproof/commitkit-rust.git +cd commitkit-rust +cargo install --path . +``` + +## Korištenje + +Otvorite svoj git repozitorij i pokrenite: + +```shell +commitkit +``` + +### Opcije komandne linije + +```text +USAGE: + commitkit [OPTIONS] + +OPTIONS: + -d, --dry-run Skip git commit and print the message to stdout + -v, --verbose Show verbose output + -c, --config Path to config file (default: .commitkit.toml in current or home directory) + --emoji Toggle emoji in commit messages + --template Use a specific commit template + --changelog Update changelog after committing + --install-hooks Install git hooks + --stats Show commit statistics + --days Number of days to analyze for stats (default: all) + --validate Validate a commit message file + --prepare-msg Prepare commit message (used by git hook) + --lang Display language (e.g. en, de, ja, zh-CN, pt-BR) + -h, --help Print help information + -V, --version Print version information +``` + +### Podržani jezici + +CommitKit prepoznaje jezik prikaza iz varijabli okruženja `LC_ALL`, `LC_MESSAGES` i `LANG`, ili prihvata opciju `--lang `. Podržava 48 jezika (uključujući 6 jezika pisanih zdesna nalijevo: `ar`, `ar-EG`, `ar-MA`, `fa`, `he` i `ur`). Potpunu tabelu pogledajte u [engleskom README fajlu](../../../README.md). + +### Interaktivni postupak + +Alat vas vodi kroz kreiranje konvencionalne commit poruke: + +1. Odaberite tip commita (feat, fix, docs itd.) +2. Odaberite opseg (opcionalno) +3. Unesite naslov commita +4. Unesite tijelo commita (opcionalno) +5. Unesite podnožje commita (opcionalno) + +Nakon završetka ovih koraka, CommitKit pokreće `git commit` s vašom sastavljenom porukom. + +### Primjeri + +```shell +# Basic usage +commitkit + +# Dry run - display the resulting commit message without committing +commitkit --dry-run + +# Use a custom config file +commitkit --config /path/to/custom-config.toml + +# Verbose output +commitkit --verbose + +# Use emojis in commit messages +commitkit --emoji + +# Use a template for your commit +commitkit --template feature + +# Automatically update CHANGELOG.md +commitkit --changelog + +# Install git hooks +commitkit --install-hooks + +# Show commit statistics for the last 30 days +commitkit --stats --days 30 + +# Validate a commit message +commitkit --validate .git/COMMIT_EDITMSG +``` + +## Razvoj + +### Izgradnja + +```bash +# Debug build +cargo build + +# Release build +cargo build --release +``` + +### Testiranje + +```bash +# Run all tests +cargo test + +# Run tests with output +cargo test -- --nocapture +``` + +### Provjera koda (Lint) + +```bash +# Check for linting issues +cargo clippy --all-targets --all-features + +# Apply automatic fixes +cargo clippy --fix --allow-dirty +``` + +### Formatiranje + +```bash +# Check formatting +cargo fmt -- --check + +# Apply formatting +cargo fmt +``` + +## Postavke + +CommitKit traži konfiguracijsku datoteku pod nazivom `.commitkit.toml` na sljedećim lokacijama (po redoslijedu): + +1. Trenutni direktorij +2. Korisnički početni direktorij + +Ako konfiguracijska datoteka nije pronađena, zadana datoteka će biti generisana u vašem početnom direktoriju. + +Primjer postavki: + +```toml +# CommitKit Configuration + +# Whether to add a Signed-off-by line to commits (-s flag) +sign_off_commits = false + +# Commit message prefixes following Conventional Commits specification +prefixes = [ + { title = "feat", description = "A new feature" }, + { title = "fix", description = "A bug fix" }, + { title = "docs", description = "Documentation changes" }, + { title = "style", description = "Changes that do not affect code meaning" }, + { title = "refactor", description = "Code change that neither fixes a bug nor adds a feature" }, + { title = "perf", description = "Code change that improves performance" }, + { title = "test", description = "Adding missing tests or correcting existing tests" }, + { title = "build", description = "Changes that affect the build system or external dependencies" }, + { title = "ci", description = "Changes to CI configuration files and scripts" }, + { title = "chore", description = "Other changes that don't modify src or test files" }, + { title = "revert", description = "Reverts a previous commit" } +] + +# Optional scopes to categorize changes +scopes = [ + "core", + "ui", + "docs", + "tests", + "deps" +] + +# Subject line length constraints +max_subject_len = 72 +min_subject_len = 3 + +# Feature toggles +use_emoji = true # Add emojis to commit messages +update_changelog = true # Update CHANGELOG.md automatically +validate_commit_msg = true # Validate commit messages against conventional format + +# Templates directory for custom commit templates +templates_dir = "~/.commitkit/templates" +``` + +## Licenca + +Ovaj projekat je licenciran pod MIT licencom - za detalje pogledajte datoteku [LICENSE](../../../LICENSE). + +## Doprinosi + +Doprinosi su dobrodošli! Slobodno otvorite prijave problema ili pošaljite zahtjeve za spajanje (Pull Request). + +1. Napravite fork repozitorija +2. Kreirajte svoju granu za funkcionalnost (`git checkout -b feature/amazing-feature`) +3. Sačuvajte izmjene pomoću konvencionalnih commit poruka +4. Pošaljite granu na server (`git push origin feature/amazing-feature`) +5. Otvorite Pull Request diff --git a/docs/i18n/hr/README.md b/docs/i18n/hr/README.md new file mode 100644 index 0000000..ec74593 --- /dev/null +++ b/docs/i18n/hr/README.md @@ -0,0 +1,237 @@ +[English](../../../README.md) + +# CommitKit + +[![CI](https://github.com/somethingwithproof/commitkit-rust/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/somethingwithproof/commitkit-rust/actions/workflows/ci.yml) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=somethingwithproof_commitkit-rust&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=somethingwithproof_commitkit-rust) +[![Release](https://img.shields.io/github/v/release/somethingwithproof/commitkit-rust)](https://github.com/somethingwithproof/commitkit-rust/releases) +[![Rust minimum](https://img.shields.io/badge/Rust_minimum-1.88.0-blue)](../../../Cargo.toml) +[![License](https://img.shields.io/badge/license-MIT-blue)](../../../LICENSE) +[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/somethingwithproof/commitkit-rust/badge)](https://scorecard.dev/viewer/?uri=github.com/somethingwithproof/commitkit-rust) + +CommitKit je alat naredbenog retka koji razvojnim programerima pomaže u oblikovanju dobro strukturiranih i dosljednih poruka commita prema specifikaciji [Conventional Commits](https://www.conventionalcommits.org/). Pruža interaktivno sučelje koje korisnike vodi kroz sastavljanje poruke commita s vrstom, neobaveznim opsegom, naslovom, tijelom i podnožjem. + +## Značajke + +- **Osnovne mogućnosti** + - Interaktivni odabir vrsta commita i opsega + - Prilagodljive postavke putem datoteke `.commitkit.toml` + - Nadzor najveće dopuštene duljine naslova + - Podrška za višeredna tijela commita + - Automatska provjera valjanosti unosa + - Neobavezni redak `Signed-off-by` u commitovima + - Višeplatformska kompatibilnost + +- **Proširene mogućnosti** + - Podrška za emojije u porukama commita (✨, 🐛 itd.) + - Predlošci za commit sa zamjenom rezerviranih mjesta + - Automatsko generiranje i održavanje zapisnika promjena + - Git hookovi za provjeru valjanosti i oblikovanje poruka commita + - Statistika i analiza commitova + - Interaktivni upiti za vrijednosti predložaka + +## Preduvjeti + +- **Rust**: inačica 1.88.0 ili novija (MSRV) +- **Cargo**: uključen u instalaciju jezika Rust + +## Instalacija + +### Iz izvornog koda + +```shell +git clone https://github.com/somethingwithproof/commitkit-rust.git +cd commitkit-rust +cargo install --path . +``` + +## Upotreba + +Otvorite svoj git repozitorij i pokrenite: + +```shell +commitkit +``` + +### Opcije naredbenog retka + +```text +USAGE: + commitkit [OPTIONS] + +OPTIONS: + -d, --dry-run Skip git commit and print the message to stdout + -v, --verbose Show verbose output + -c, --config Path to config file (default: .commitkit.toml in current or home directory) + --emoji Toggle emoji in commit messages + --template Use a specific commit template + --changelog Update changelog after committing + --install-hooks Install git hooks + --stats Show commit statistics + --days Number of days to analyze for stats (default: all) + --validate Validate a commit message file + --prepare-msg Prepare commit message (used by git hook) + --lang Display language (e.g. en, de, ja, zh-CN, pt-BR) + -h, --help Print help information + -V, --version Print version information +``` + +### Podržani jezici + +CommitKit prepoznaje jezik prikaza iz varijabli okruženja `LC_ALL`, `LC_MESSAGES` i `LANG`, ili prihvaća opciju `--lang `. Podržava 48 jezika (uključujući 6 jezika pisanih zdesna nalijevo: `ar`, `ar-EG`, `ar-MA`, `fa`, `he` i `ur`). Cjelovitu tablicu potražite u [engleskoj datoteci README](../../../README.md). + +### Interaktivni postupak + +Alat vas vodi kroz postupak izrade konvencionalne poruke commita: + +1. Odaberite vrstu commita (feat, fix, docs itd.) +2. Odaberite opseg (neobavezno) +3. Unesite naslov commita +4. Unesite tijelo commita (neobavezno) +5. Unesite podnožje commita (neobavezno) + +Nakon dovršetka ovih koraka, CommitKit pokreće `git commit` s vašom sastavljenom porukom. + +### Primjeri + +```shell +# Basic usage +commitkit + +# Dry run - display the resulting commit message without committing +commitkit --dry-run + +# Use a custom config file +commitkit --config /path/to/custom-config.toml + +# Verbose output +commitkit --verbose + +# Use emojis in commit messages +commitkit --emoji + +# Use a template for your commit +commitkit --template feature + +# Automatically update CHANGELOG.md +commitkit --changelog + +# Install git hooks +commitkit --install-hooks + +# Show commit statistics for the last 30 days +commitkit --stats --days 30 + +# Validate a commit message +commitkit --validate .git/COMMIT_EDITMSG +``` + +## Razvoj + +### Izgradnja + +```bash +# Debug build +cargo build + +# Release build +cargo build --release +``` + +### Testiranje + +```bash +# Run all tests +cargo test + +# Run tests with output +cargo test -- --nocapture +``` + +### Provjera koda (Lint) + +```bash +# Check for linting issues +cargo clippy --all-targets --all-features + +# Apply automatic fixes +cargo clippy --fix --allow-dirty +``` + +### Oblikovanje + +```bash +# Check formatting +cargo fmt -- --check + +# Apply formatting +cargo fmt +``` + +## Postavke + +CommitKit traži datoteku s postavkama naziva `.commitkit.toml` na sljedećim lokacijama (redom): + +1. Trenutačna mapa +2. Osobna mapa korisnika + +Ako datoteka s postavkama nije pronađena, zadana će se datoteka izraditi u vašoj osobnoj mapi. + +Primjer postavki: + +```toml +# CommitKit Configuration + +# Whether to add a Signed-off-by line to commits (-s flag) +sign_off_commits = false + +# Commit message prefixes following Conventional Commits specification +prefixes = [ + { title = "feat", description = "A new feature" }, + { title = "fix", description = "A bug fix" }, + { title = "docs", description = "Documentation changes" }, + { title = "style", description = "Changes that do not affect code meaning" }, + { title = "refactor", description = "Code change that neither fixes a bug nor adds a feature" }, + { title = "perf", description = "Code change that improves performance" }, + { title = "test", description = "Adding missing tests or correcting existing tests" }, + { title = "build", description = "Changes that affect the build system or external dependencies" }, + { title = "ci", description = "Changes to CI configuration files and scripts" }, + { title = "chore", description = "Other changes that don't modify src or test files" }, + { title = "revert", description = "Reverts a previous commit" } +] + +# Optional scopes to categorize changes +scopes = [ + "core", + "ui", + "docs", + "tests", + "deps" +] + +# Subject line length constraints +max_subject_len = 72 +min_subject_len = 3 + +# Feature toggles +use_emoji = true # Add emojis to commit messages +update_changelog = true # Update CHANGELOG.md automatically +validate_commit_msg = true # Validate commit messages against conventional format + +# Templates directory for custom commit templates +templates_dir = "~/.commitkit/templates" +``` + +## Licenca + +Ovaj je projekt licenciran pod MIT licencom - pojedinosti potražite u datoteci [LICENSE](../../../LICENSE). + +## Doprinos projektu + +Doprinosi su dobrodošli! Slobodno otvorite prijave pogrešaka ili pošaljite zahtjeve za spajanje (Pull Request). + +1. Napravite fork repozitorija +2. Stvorite svoju granu za značajku (`git checkout -b feature/amazing-feature`) +3. Pohranite promjene koristeći konvencionalne poruke commita +4. Pošaljite granu na poslužitelj (`git push origin feature/amazing-feature`) +5. Otvorite Pull Request diff --git a/docs/i18n/sr/README.md b/docs/i18n/sr/README.md new file mode 100644 index 0000000..2922b35 --- /dev/null +++ b/docs/i18n/sr/README.md @@ -0,0 +1,237 @@ +[English](../../../README.md) + +# CommitKit + +[![CI](https://github.com/somethingwithproof/commitkit-rust/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/somethingwithproof/commitkit-rust/actions/workflows/ci.yml) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=somethingwithproof_commitkit-rust&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=somethingwithproof_commitkit-rust) +[![Release](https://img.shields.io/github/v/release/somethingwithproof/commitkit-rust)](https://github.com/somethingwithproof/commitkit-rust/releases) +[![Rust minimum](https://img.shields.io/badge/Rust_minimum-1.88.0-blue)](../../../Cargo.toml) +[![License](https://img.shields.io/badge/license-MIT-blue)](../../../LICENSE) +[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/somethingwithproof/commitkit-rust/badge)](https://scorecard.dev/viewer/?uri=github.com/somethingwithproof/commitkit-rust) + +CommitKit је алат командне линије који помаже програмерима да пишу добро структурисане и доследне комит поруке у складу са спецификацијом [Conventional Commits](https://www.conventionalcommits.org/). Пружа интерактивни интерфејс који води кориснике кроз састављање комит поруке са типом, опционим опсегом, насловом, телом и подножјем. + +## Функције + +- **Основне функционалности** + - Интерактивни избор типова комита и опсега + - Прилагодљива подешавања преко датотеке `.commitkit.toml` + - Контрола максималне дужине наслова + - Подршка за вишередна тела комита + - Аутоматска провера уноса + - Опциона `Signed-off-by` линија у комитовима + - Вишеплатформска компатибилност + +- **Напредне функције** + - Подршка за емоџије у комит порукама (✨, 🐛 итд.) + - Шаблони за комит са заменом параметара + - Аутоматско генерисање и одржавање дневника промена + - Git куке (hooks) за проверу и форматирање комит порука + - Статистика и анализа комитова + - Интерактивни упити за вредности у шаблонима + +## Предуслови + +- **Rust**: верзија 1.88.0 или новија (MSRV) +- **Cargo**: укључен уз инсталацију Rust-а + +## Инсталација + +### Из изворног кода + +```shell +git clone https://github.com/somethingwithproof/commitkit-rust.git +cd commitkit-rust +cargo install --path . +``` + +## Коришћење + +Отворите свој git репозиторијум и покрените: + +```shell +commitkit +``` + +### Опције командне линије + +```text +USAGE: + commitkit [OPTIONS] + +OPTIONS: + -d, --dry-run Skip git commit and print the message to stdout + -v, --verbose Show verbose output + -c, --config Path to config file (default: .commitkit.toml in current or home directory) + --emoji Toggle emoji in commit messages + --template Use a specific commit template + --changelog Update changelog after committing + --install-hooks Install git hooks + --stats Show commit statistics + --days Number of days to analyze for stats (default: all) + --validate Validate a commit message file + --prepare-msg Prepare commit message (used by git hook) + --lang Display language (e.g. en, de, ja, zh-CN, pt-BR) + -h, --help Print help information + -V, --version Print version information +``` + +### Подржани језици + +CommitKit препознаје језик приказа из променљивих окружења `LC_ALL`, `LC_MESSAGES` и `LANG`, или прихвата опцију `--lang `. Подржава 48 језика (укључујући 6 језика писаних здесна налево: `ar`, `ar-EG`, `ar-MA`, `fa`, `he` и `ur`). Потпуну табелу погледајте у [енглеској датотеци README](../../../README.md). + +### Интерактивни поступак + +Алат вас води кроз креирање конвенционалне комит поруке: + +1. Изаберите тип комита (feat, fix, docs итд.) +2. Изаберите опсег (опционо) +3. Унесите наслов комита +4. Унесите тело комита (опционо) +5. Унесите подножје комита (опционо) + +По завршетку ових корака, CommitKit покреће `git commit` са вашом састављеном поруком. + +### Примери + +```shell +# Basic usage +commitkit + +# Dry run - display the resulting commit message without committing +commitkit --dry-run + +# Use a custom config file +commitkit --config /path/to/custom-config.toml + +# Verbose output +commitkit --verbose + +# Use emojis in commit messages +commitkit --emoji + +# Use a template for your commit +commitkit --template feature + +# Automatically update CHANGELOG.md +commitkit --changelog + +# Install git hooks +commitkit --install-hooks + +# Show commit statistics for the last 30 days +commitkit --stats --days 30 + +# Validate a commit message +commitkit --validate .git/COMMIT_EDITMSG +``` + +## Развој + +### Изградња + +```bash +# Debug build +cargo build + +# Release build +cargo build --release +``` + +### Тестирање + +```bash +# Run all tests +cargo test + +# Run tests with output +cargo test -- --nocapture +``` + +### Провера кода (Lint) + +```bash +# Check for linting issues +cargo clippy --all-targets --all-features + +# Apply automatic fixes +cargo clippy --fix --allow-dirty +``` + +### Форматирање + +```bash +# Check formatting +cargo fmt -- --check + +# Apply formatting +cargo fmt +``` + +## Подешавања + +CommitKit тражи датотеку подешавања под називом `.commitkit.toml` на следећим локацијама (по редоследу): + +1. Тренутни директоријум +2. Кориснички почетни директоријум + +Ако датотека подешавања није пронађена, подразумевана датотека ће бити генерисана у вашем почетном директоријуму. + +Пример подешавања: + +```toml +# CommitKit Configuration + +# Whether to add a Signed-off-by line to commits (-s flag) +sign_off_commits = false + +# Commit message prefixes following Conventional Commits specification +prefixes = [ + { title = "feat", description = "A new feature" }, + { title = "fix", description = "A bug fix" }, + { title = "docs", description = "Documentation changes" }, + { title = "style", description = "Changes that do not affect code meaning" }, + { title = "refactor", description = "Code change that neither fixes a bug nor adds a feature" }, + { title = "perf", description = "Code change that improves performance" }, + { title = "test", description = "Adding missing tests or correcting existing tests" }, + { title = "build", description = "Changes that affect the build system or external dependencies" }, + { title = "ci", description = "Changes to CI configuration files and scripts" }, + { title = "chore", description = "Other changes that don't modify src or test files" }, + { title = "revert", description = "Reverts a previous commit" } +] + +# Optional scopes to categorize changes +scopes = [ + "core", + "ui", + "docs", + "tests", + "deps" +] + +# Subject line length constraints +max_subject_len = 72 +min_subject_len = 3 + +# Feature toggles +use_emoji = true # Add emojis to commit messages +update_changelog = true # Update CHANGELOG.md automatically +validate_commit_msg = true # Validate commit messages against conventional format + +# Templates directory for custom commit templates +templates_dir = "~/.commitkit/templates" +``` + +## Лиценца + +Овај пројекат је лиценциран под MIT лиценцом - за детаље погледајте датотеку [LICENSE](../../../LICENSE). + +## Доприноси + +Доприноси су добродошли! Слободно отворите пријаве проблема или пошаљите захтеве за спајање (Pull Request). + +1. Направите fork репозиторијума +2. Креирајте своју грану за функцију (`git checkout -b feature/amazing-feature`) +3. Сачувајте измене помоћу конвенционалних комит порука +4. Пошаљите грану на сервер (`git push origin feature/amazing-feature`) +5. Отворите Pull Request diff --git a/src/i18n/catalog.rs b/src/i18n/catalog.rs index 7130a6c..a10ea55 100644 --- a/src/i18n/catalog.rs +++ b/src/i18n/catalog.rs @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: 2025-2026 Thomas Vincent // SPDX-License-Identifier: MIT -//! Static translation catalogs for all 45 supported locales. +//! Static translation catalogs for all 48 supported locales. use super::Locale; @@ -210,6 +210,9 @@ pub const fn for_locale(locale: Locale) -> &'static Catalog { Locale::Ur => &UR, Locale::Ms => &MS, Locale::Fil => &FIL, + Locale::Bs => &BS, + Locale::Hr => &HR, + Locale::Sr => &SR, } } @@ -3438,3 +3441,221 @@ const FIL: Catalog = Catalog { stats_top_scopes: "Mga nangungunang saklaw:", stats_top_contributors: "Mga nangungunang contributor:", }; + +const BS: Catalog = Catalog { + cli_about: "CLI alat za kreiranje konvencionalnih commit poruka", + cli_opt_dry_run: "Preskoči git commit i ispiši poruku na standardni izlaz", + cli_opt_verbose: "Prikaži detaljan izlaz", + cli_opt_config: + "Putanja do konfiguracijske datoteke (zadano: .commitkit.toml u trenutnom ili početnom direktoriju)", + cli_opt_emoji: "Uključi ili isključi emoji u commit porukama", + cli_opt_template: "Koristi određeni šablon za commit", + cli_opt_changelog: "Ažuriraj dnevnik promjena nakon commita", + cli_opt_install_hooks: "Instaliraj git hookove", + cli_opt_stats: "Prikaži statistiku commitova", + cli_opt_days: "Broj dana za analizu statistike (zadano: sve)", + cli_opt_validate: "Provjeri datoteku s commit porukom", + cli_opt_prepare_msg: "Pripremi commit poruku (koristi git hook)", + cli_opt_lang: "Jezik prikaza (npr. en, de, ja, zh-CN, pt-BR, bs)", + prompt_select_type: "Odaberite tip commita", + prompt_select_scope: "Odaberite opseg (opcionalno)", + prompt_scope_none: "Ništa", + prompt_subject: "Unesite naslov commita (najviše {max} znakova)", + err_subject_empty: "Naslov ne smije biti prazan", + err_subject_too_long: "Naslov je predugačak", + prompt_body: "Unesite tijelo commita (ostavite prazno za preskakanje):", + prompt_body_hint: + "Pritisnite Ctrl+D (Unix) ili Ctrl+Z (Windows), a zatim Enter kada završite.", + prompt_footer: "Unesite podnožje commita (opcionalno)", + prompt_template_value: "Unesite vrijednost za {name}: ", + err_prompt_prefix: "Greška pri preuzimanju odabira prefiksa", + err_prompt_scope: "Greška pri preuzimanju odabira opsega", + err_prompt_subject: "Greška pri preuzimanju naslova commita", + err_prompt_footer: "Greška pri preuzimanju podnožja commita", + err_prompt_custom: "Greška pri preuzimanju unosa za: {prompt}", + err_prefix: "Greška: {error}", + err_config_not_found: "Konfiguracijska datoteka nije pronađena: {path}", + err_config_read: "Greška pri čitanju konfiguracijske datoteke: {path}", + err_config_parse: "Greška pri obradi konfiguracije iz {path}", + err_not_git_repo: "Niste unutar git repozitorija", + err_no_staged_changes: + "Nema pripremljenih izmjena za commit. Prvo pripremite izmjene naredbom 'git add'.", + msg_loading_config: "Učitavanje postavki...", + msg_starting_interactive: "Pokretanje interaktivnog procesa commita...", + msg_generated: "Commit poruka je uspješno generisana.", + dry_run_header: "--- Commit poruka ---", + dry_run_template_header: "--- Commit poruka iz šablona ---", + msg_dry_run_notice: "Probni način rada: commit nije izvršen.", + msg_executing_commit: "Izvršavanje naredbe git commit...", + err_commit_failed: "Commit izmjena nije uspio", + msg_commit_success: "Izmjene su uspješno sačuvane commitom!", + msg_template_commit_success: "Izmjene su uspješno sačuvane commitom pomoću šablona!", + msg_updating_changelog: "Ažuriranje dnevnika promjena...", + err_changelog_update: "Ažuriranje dnevnika promjena nije uspjelo", + msg_changelog_updated: "Dnevnik promjena je uspješno ažuriran.", + err_install_prepare_hook: "Instalacija prepare-commit-msg hooka nije uspjela", + err_install_commit_msg_hook: "Instalacija commit-msg hooka nije uspjela", + msg_hooks_installed: "Git hookovi su uspješno instalirani!", + msg_installed_hooks_header: "Instalirani hookovi:", + msg_hook_prepare_desc: "prepare-commit-msg: za automatsko formatiranje poruka", + msg_hook_validate_desc: "commit-msg: za provjeru commit poruka", + msg_commit_valid: "Commit poruka je ispravna.", + err_validation_format: "Neispravan format. Očekivano: [(scope)]: ", + err_validation_type: "Neispravan tip commita. Koristite jedan od konvencionalnih tipova.", + err_validation_short: "Naslov je prekratak. Napišite opisniji naslov.", + err_validation_long: "Naslov je predugačak. Ostanite unutar maksimalne dužine.", + err_validation_scope: "Neispravan format opsega.", + err_template_not_found: "Šablon '{name}' nije pronađen", + msg_using_template: "Korištenje šablona: {name} - {description}", + stats_header: "Statistika commitova za proteklih {days} dana:", + stats_days_all: "svih", + stats_total_commits: "Ukupno commitova: {count}", + stats_commit_types: "Tipovi commitova:", + stats_top_scopes: "Najčešći opsezi:", + stats_top_contributors: "Najaktivniji doprinosioci:", +}; + +const HR: Catalog = Catalog { + cli_about: "Alat naredbenog retka za izradu poruka prema specifikaciji Conventional Commits", + cli_opt_dry_run: "Preskoči git commit i ispiši poruku na standardni izlaz", + cli_opt_verbose: "Prikaži opširan ispis", + cli_opt_config: + "Putanja do datoteke s postavkama (zadano: .commitkit.toml u trenutačnoj ili osobnoj mapi)", + cli_opt_emoji: "Uključi ili isključi emojije u porukama commita", + cli_opt_template: "Upotrijebi određeni predložak za commit", + cli_opt_changelog: "Ažuriraj zapisnik promjena nakon commita", + cli_opt_install_hooks: "Instaliraj git hookove", + cli_opt_stats: "Prikaži statistiku commitova", + cli_opt_days: "Broj dana za analizu statistike (zadano: sve)", + cli_opt_validate: "Provjeri valjanost datoteke s porukom commita", + cli_opt_prepare_msg: "Pripremi poruku commita (koristi git hook)", + cli_opt_lang: "Jezik prikaza (npr. en, de, ja, zh-CN, pt-BR, hr)", + prompt_select_type: "Odaberite vrstu commita", + prompt_select_scope: "Odaberite opseg (neobavezno)", + prompt_scope_none: "Ništa", + prompt_subject: "Unesite naslov commita (najviše {max} znakova)", + err_subject_empty: "Naslov ne može biti prazan", + err_subject_too_long: "Naslov je predugačak", + prompt_body: "Unesite tijelo commita (ostavite prazno za preskakanje):", + prompt_body_hint: "Pritisnite Ctrl+D (Unix) ili Ctrl+Z (Windows), a zatim Enter kada završite.", + prompt_footer: "Unesite podnožje commita (neobavezno)", + prompt_template_value: "Unesite vrijednost za {name}: ", + err_prompt_prefix: "Nije moguće dohvatiti odabir prefiksa", + err_prompt_scope: "Nije moguće dohvatiti odabir opsega", + err_prompt_subject: "Nije moguće dohvatiti naslov commita", + err_prompt_footer: "Nije moguće dohvatiti podnožje commita", + err_prompt_custom: "Nije moguće dohvatiti unos za: {prompt}", + err_prefix: "Pogreška: {error}", + err_config_not_found: "Datoteka s postavkama nije pronađena: {path}", + err_config_read: "Nije moguće pročitati datoteku s postavkama: {path}", + err_config_parse: "Nije moguće raščlaniti postavke iz {path}", + err_not_git_repo: "Niste u git repozitoriju", + err_no_staged_changes: + "Nema pripremljenih promjena za commit. Najprije ih dodajte naredbom 'git add'.", + msg_loading_config: "Učitavanje postavki...", + msg_starting_interactive: "Pokretanje interaktivnog postupka commita...", + msg_generated: "Poruka commita uspješno je stvorena.", + dry_run_header: "--- Poruka commita ---", + dry_run_template_header: "--- Poruka commita iz predloška ---", + msg_dry_run_notice: "Probni rad: commit nije pohranjen.", + msg_executing_commit: "Izvođenje naredbe git commit...", + err_commit_failed: "Pohrana promjena commitom nije uspjela", + msg_commit_success: "Promjene su uspješno pohranjene commitom!", + msg_template_commit_success: "Promjene su uspješno pohranjene commitom pomoću predloška!", + msg_updating_changelog: "Ažuriranje zapisnika promjena...", + err_changelog_update: "Ažuriranje zapisnika promjena nije uspjelo", + msg_changelog_updated: "Zapisnik promjena uspješno je ažuriran.", + err_install_prepare_hook: "Instalacija hooka prepare-commit-msg nije uspjela", + err_install_commit_msg_hook: "Instalacija hooka commit-msg nije uspjela", + msg_hooks_installed: "Git hookovi uspješno su instalirani!", + msg_installed_hooks_header: "Instalirani hookovi:", + msg_hook_prepare_desc: "prepare-commit-msg: za automatsko oblikovanje poruka", + msg_hook_validate_desc: "commit-msg: za provjeru valjanosti poruka commita", + msg_commit_valid: "Poruka commita je valjana.", + err_validation_format: "Nevaljan format. Očekivano: [(scope)]: ", + err_validation_type: "Nevaljana vrsta commita. Upotrijebite jednu od standardnih vrsta.", + err_validation_short: "Naslov je prekratak. Napišite jasniji opis.", + err_validation_long: "Naslov je predugačak. Ostanite unutar dopuštene duljine.", + err_validation_scope: "Nevaljan format opsega.", + err_template_not_found: "Predložak '{name}' nije pronađen", + msg_using_template: "Upotreba predloška: {name} - {description}", + stats_header: "Statistika commitova za proteklih {days} dana:", + stats_days_all: "svih", + stats_total_commits: "Ukupno commitova: {count}", + stats_commit_types: "Vrste commitova:", + stats_top_scopes: "Najčešći opsezi:", + stats_top_contributors: "Najistaknutiji suradnici:", +}; + +const SR: Catalog = Catalog { + cli_about: "CLI алат за креирање конвенционалних комит порука", + cli_opt_dry_run: "Прескочи git commit и испиши поруку на стандардни излаз", + cli_opt_verbose: "Прикажи детаљан излаз", + cli_opt_config: + "Путања до датотеке подешавања (подразумевано: .commitkit.toml у тренутном или корисничком директоријуму)", + cli_opt_emoji: "Укључи или искључи емоџије у комит порукама", + cli_opt_template: "Користи одређени шаблон за комит", + cli_opt_changelog: "Ажурирај дневник промена после комита", + cli_opt_install_hooks: "Инсталирај git куке (hooks)", + cli_opt_stats: "Прикажи статистику комитова", + cli_opt_days: "Број дана за анализу статистике (подразумевано: све)", + cli_opt_validate: "Провери датотеку са комит поруком", + cli_opt_prepare_msg: "Припреми комит поруку (користи git кука)", + cli_opt_lang: "Језик приказа (нпр. en, de, ja, zh-CN, pt-BR, sr)", + prompt_select_type: "Изаберите тип комита", + prompt_select_scope: "Изаберите опсег (опционо)", + prompt_scope_none: "Ништа", + prompt_subject: "Унесите наслов комита (највише {max} знакова)", + err_subject_empty: "Наслов не може бити празан", + err_subject_too_long: "Наслов је предугачак", + prompt_body: "Унесите тело комита (оставите празно за прескакање):", + prompt_body_hint: + "Притисните Ctrl+D (Unix) или Ctrl+Z (Windows), а затим Enter када завршите.", + prompt_footer: "Унесите подножје комита (опционо)", + prompt_template_value: "Унесите вредност за {name}: ", + err_prompt_prefix: "Грешка при преузимању избора префикса", + err_prompt_scope: "Грешка при преузимању избора опсега", + err_prompt_subject: "Грешка при преузимању наслова комита", + err_prompt_footer: "Грешка при преузимању подножја комита", + err_prompt_custom: "Грешка при преузимању уноса за: {prompt}", + err_prefix: "Грешка: {error}", + err_config_not_found: "Датотека подешавања није пронађена: {path}", + err_config_read: "Грешка при читању датотеке подешавања: {path}", + err_config_parse: "Грешка при обради подешавања из {path}", + err_not_git_repo: "Нисте унутар git репозиторијума", + err_no_staged_changes: + "Нема припремљених измена за комит. Прво припремите измене командом 'git add'.", + msg_loading_config: "Учитавање подешавања...", + msg_starting_interactive: "Покретање интерактивног поступка комита...", + msg_generated: "Комит порука је успешно генерисана.", + dry_run_header: "--- Комит порука ---", + dry_run_template_header: "--- Комит порука из шаблона ---", + msg_dry_run_notice: "Пробни режим: комит није направљен.", + msg_executing_commit: "Извршавање команде git commit...", + err_commit_failed: "Комит измена није успео", + msg_commit_success: "Измене су успешно сачуване комитом!", + msg_template_commit_success: "Измене су успешно сачуване комитом помоћу шаблона!", + msg_updating_changelog: "Ажурирање дневника промена...", + err_changelog_update: "Ажурирање дневника промена није успело", + msg_changelog_updated: "Дневник промена је успешно ажуриран.", + err_install_prepare_hook: "Инсталација prepare-commit-msg куке није успела", + err_install_commit_msg_hook: "Инсталација commit-msg куке није успела", + msg_hooks_installed: "Git куке су успешно инсталиране!", + msg_installed_hooks_header: "Инсталиране куке:", + msg_hook_prepare_desc: "prepare-commit-msg: за аутоматско форматирање порука", + msg_hook_validate_desc: "commit-msg: за проверу комит порука", + msg_commit_valid: "Комит порука је исправна.", + err_validation_format: "Неисправан формат. Очекивано: [(scope)]: ", + err_validation_type: "Неисправан тип комита. Користите један од конвенционалних типова.", + err_validation_short: "Наслов је прекратак. Напишите описнији наслов.", + err_validation_long: "Наслов је предугачак. Останите унутар максималне дужине.", + err_validation_scope: "Неисправан формат опсега.", + err_template_not_found: "Шаблон '{name}' није пронађен", + msg_using_template: "Коришћење шаблона: {name} - {description}", + stats_header: "Статистика комитова за протеклих {days} дана:", + stats_days_all: "свих", + stats_total_commits: "Укупно комитова: {count}", + stats_commit_types: "Типови комитова:", + stats_top_scopes: "Најчешћи опсези:", + stats_top_contributors: "Најактивнији сарадници:", +}; diff --git a/src/i18n/mod.rs b/src/i18n/mod.rs index 7004854..db3c5b3 100644 --- a/src/i18n/mod.rs +++ b/src/i18n/mod.rs @@ -3,7 +3,7 @@ //! Internationalization (i18n) support for CommitKit. //! -//! Provides compile-time checked translations for 45 locales (including 6 RTL +//! Provides compile-time checked translations for 48 locales (including 6 RTL //! locales) with POSIX environment detection (`LC_ALL` -> `LC_MESSAGES` -> `LANG`) //! and optional explicit override via `--lang`. @@ -60,11 +60,14 @@ pub enum Locale { Ur, Ms, Fil, + Bs, + Hr, + Sr, } impl Locale { - /// All 45 supported locales. - pub const ALL: [Locale; 45] = [ + /// All 48 supported locales. + pub const ALL: [Locale; 48] = [ Locale::En, Locale::De, Locale::Es, @@ -110,6 +113,9 @@ impl Locale { Locale::Ur, Locale::Ms, Locale::Fil, + Locale::Bs, + Locale::Hr, + Locale::Sr, ]; /// Canonical BCP 47 language tag for this locale. @@ -160,6 +166,9 @@ impl Locale { Locale::Ur => "ur", Locale::Ms => "ms", Locale::Fil => "fil", + Locale::Bs => "bs", + Locale::Hr => "hr", + Locale::Sr => "sr", } } @@ -275,6 +284,9 @@ impl Locale { "ur" => Some(Locale::Ur), "ms" => Some(Locale::Ms), "fil" | "tl" => Some(Locale::Fil), + "bs" => Some(Locale::Bs), + "hr" => Some(Locale::Hr), + "sr" => Some(Locale::Sr), _ => None, } } @@ -421,8 +433,8 @@ mod tests { } #[test] - fn test_all_45_locales_parse() { - assert_eq!(Locale::ALL.len(), 45); + fn test_all_48_locales_parse() { + assert_eq!(Locale::ALL.len(), 48); for locale in Locale::ALL { assert_eq!(Locale::from_tag(locale.code()), Some(locale)); } @@ -476,6 +488,21 @@ mod tests { assert_eq!(Locale::from_tag("ur_PK.UTF-8"), Some(Locale::Ur)); assert_eq!(Locale::from_tag("ms_MY.UTF-8"), Some(Locale::Ms)); + // Bosnian, Croatian, and Serbian tags (including regional and script variants) + assert_eq!(Locale::from_tag("bs"), Some(Locale::Bs)); + assert_eq!(Locale::from_tag("bs-BA"), Some(Locale::Bs)); + assert_eq!(Locale::from_tag("bs_BA.UTF-8"), Some(Locale::Bs)); + assert_eq!(Locale::from_tag("hr"), Some(Locale::Hr)); + assert_eq!(Locale::from_tag("hr-HR"), Some(Locale::Hr)); + assert_eq!(Locale::from_tag("hr_HR.UTF-8"), Some(Locale::Hr)); + assert_eq!(Locale::from_tag("sr"), Some(Locale::Sr)); + assert_eq!(Locale::from_tag("sr-RS"), Some(Locale::Sr)); + assert_eq!(Locale::from_tag("sr-Cyrl"), Some(Locale::Sr)); + assert_eq!(Locale::from_tag("sr-Latn"), Some(Locale::Sr)); + assert_eq!(Locale::from_tag("sr-Cyrl-RS"), Some(Locale::Sr)); + assert_eq!(Locale::from_tag("sr-Latn-RS"), Some(Locale::Sr)); + assert_eq!(Locale::from_tag("sr_RS.UTF-8"), Some(Locale::Sr)); + // Empty and unknown tags assert_eq!(Locale::from_tag(""), None); assert_eq!(Locale::from_tag(" "), None); @@ -496,7 +523,7 @@ mod tests { .collect(); assert_eq!(rtl_locales.len(), 6); - assert_eq!(ltr_locales.len(), 39); + assert_eq!(ltr_locales.len(), 42); assert_eq!( rtl_locales, vec![ @@ -535,6 +562,24 @@ mod tests { } } + #[test] + fn test_south_slavic_catalogs_are_distinct() { + let bs = Locale::Bs.catalog().entries(); + let hr = Locale::Hr.catalog().entries(); + let sr = Locale::Sr.catalog().entries(); + assert_ne!(bs, hr, "Bosnian and Croatian catalogs must be distinct"); + assert_ne!(bs, sr, "Bosnian and Serbian catalogs must be distinct"); + assert_ne!(hr, sr, "Croatian and Serbian catalogs must be distinct"); + assert!( + Locale::Sr + .catalog() + .cli_about + .chars() + .any(|c| ('\u{0400}'..='\u{04FF}').contains(&c)), + "Serbian catalog must use Cyrillic script" + ); + } + #[test] fn test_default_english_strings_backward_compatible() { let en = Locale::En.catalog();