Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check translations at compile time #86

Merged
merged 12 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ repos:
--,
-D,
clippy::print_stdout,
-D,
warnings,
]
- id: clippy
alias: clippy-hydrate
Expand All @@ -55,6 +57,8 @@ repos:
--,
-D,
clippy::print_stdout,
-D,
warnings,
]
- id: clippy
alias: clippy-ssr-actix
Expand All @@ -68,6 +72,8 @@ repos:
--,
-D,
clippy::print_stdout,
-D,
warnings,
]
- id: clippy
alias: clippy-ssr-axum
Expand All @@ -81,6 +87,8 @@ repos:
--,
-D,
clippy::print_stdout,
-D,
warnings,
]
- repo: https://github.com/mondeja/rust-pc-hooks
rev: v1.1.0
Expand Down
13 changes: 10 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
# CHANGELOG

## Unreleased - [0.0.29]
## 2024-06-03 - [0.0.29]

### Breaking changes

- Replace `I18n.is_active_language(lang)` method by `Language.is_active()`.
Use `<input ... checked=lang.is_active() ... />` instead of
`<input ... checked=i18n.is_active_language(lang) ... />`.
- Removed `I18n.default_language()` method. Use `i18n.languages[0]`.
- Removed `I18n.tr()` and `I18n.trs()` methods. Use `tr!` macro.
- Removed `I18n.tr()` and `I18n.trs()` methods. Use the `tr!` macro.
- `tr!` and `move_tr!` macros only accepts literal strings as the message name
(first argument) and in the keys of translation arguments.

### New features

- Add `check_translations` argument to `leptos_fluent!` macro to check
translations at compile time.

## 2024-06-01 - [0.0.28]

Expand Down Expand Up @@ -132,7 +139,7 @@

- Added all ISO-639-1 and ISO-639-2 languages.

[0.0.29]: https://github.com/mondeja/leptos-fluent/compare/v0.0.28...master
[0.0.29]: https://github.com/mondeja/leptos-fluent/compare/v0.0.28...v0.0.29
[0.0.28]: https://github.com/mondeja/leptos-fluent/compare/v0.0.27...v0.0.28
[0.0.27]: https://github.com/mondeja/leptos-fluent/compare/v0.0.26...v0.0.27
[0.0.26]: https://github.com/mondeja/leptos-fluent/compare/v0.0.25...v0.0.26
Expand Down
107 changes: 70 additions & 37 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ members = [
]
resolver = "2"

[workspace.package]
edition = "2021"
version = "0.1.0"
license = "MIT"
documentation = "https://docs.rs/leptos-fluent"
repository = "https://github.com/mondeja/leptos-fluent"
[workspace.dependencies]
fluent-templates = "0.9"

[profile.wasm-release]
inherits = "release"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Add the following to your `Cargo.toml` file:

```toml
[dependencies]
leptos-fluent = "0.0.28"
leptos-fluent = "0.0.29"
fluent-templates = "0.9"

[features]
Expand Down
2 changes: 2 additions & 0 deletions examples/csr-complete/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ pub fn App() -> impl IntoView {
leptos_fluent! {{
translations: TRANSLATIONS,
languages: "./locales/languages.json",
locales: "./locales",
check_translations: "./src/**/*.rs",
sync_html_tag_lang: true,
url_param: "lang",
initial_language_from_url_param: true,
Expand Down
Loading