Skip to content
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
12 changes: 0 additions & 12 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion leptos-fluent-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ serde_json = { version = "1", optional = true }
serde_yaml = { version = "0.9", optional = true }
json5 = { version = "0.4", optional = true }
tracing = { version = "0.1", optional = true }
proc-macro-warning = "1"

[dev-dependencies]
trybuild = "1"
Expand Down
1 change: 0 additions & 1 deletion leptos-fluent-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2184,7 +2184,6 @@ pub fn leptos_fluent(
#customise_quote
};
}
#warnings_quote
},
quote!(vec![&TRS]),
)
Expand Down
56 changes: 2 additions & 54 deletions leptos-fluent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,10 @@ use core::str::FromStr;
use fluent_bundle::FluentValue;
use fluent_templates::{loader::Loader, LanguageIdentifier, StaticLoader};
#[cfg(feature = "nightly")]
use leptos::prelude::Get;
#[allow(unused_imports)]
use leptos::prelude::Set;
use leptos::prelude::{Get, Set};
use leptos::{
attr::AttributeValue,
prelude::{guards::ReadGuard, use_context, Read, RwSignal, Signal, With},
prelude::{guards::ReadGuard, Read, RwSignal, Signal, With},
};
use std::borrow::Cow;
use std::sync::LazyLock;
Expand Down Expand Up @@ -691,56 +689,6 @@ impl Fn<(&'static Language,)> for I18n {
}
}

/// Get the current context for localization.
#[deprecated(
since = "0.2.13",
note = "will be removed in v0.3.0. Use `use_context::<leptos_fluent::I18n>()` instead of `use_i18n()`."
)]
#[cfg_attr(feature = "tracing", tracing::instrument(level = "trace"))]
#[inline(always)]
pub fn use_i18n() -> Option<I18n> {
use_context::<I18n>()
}

const EXPECT_I18N_ERROR_MESSAGE: &str = concat!(
"I18n context is missing, use the `leptos_fluent!` macro to provide it.\n\n",
"If you're sure that the context has been provided probably the invocation",
" resides outside of the reactive ownership tree, thus the context is not",
" reachable. Use instead:\n",
" - `tr!(i18n, \"text-id\")` instead of `tr!(\"text-id\")`.\n",
" - `move_tr!(i18n, \"text-id\")` instead of `move_tr!(\"text-id\")`.\n",
" - Copy `i18n` context instead of getting it with `expect_context::<leptos_fluent::I18n>()`.",
);

/// Expect the current context for localization.
#[deprecated(
since = "0.2.13",
note = "will be removed in v0.3.0. Use `expect_context::<leptos_fluent::I18n>()` instead of `expect_i18n()`."
)]
#[cfg_attr(feature = "tracing", tracing::instrument(level = "trace"))]
#[inline]
pub fn expect_i18n() -> I18n {
if let Some(i18n) = use_context::<I18n>() {
i18n
} else {
#[cfg(feature = "tracing")]
tracing::error!(EXPECT_I18N_ERROR_MESSAGE);
panic!("{}", EXPECT_I18N_ERROR_MESSAGE)
}
}

/// Expect the current context for localization.
#[deprecated(
since = "0.2.13",
note = "will be removed in v0.3.0. Use `expect_context::<leptos_fluent::I18n>()` instead of `i18n()`."
)]
#[cfg_attr(feature = "tracing", tracing::instrument(level = "trace"))]
#[inline(always)]
pub fn i18n() -> I18n {
#[allow(deprecated)]
expect_i18n()
}

/// Translate a text identifier to the current language.
///
/// ```rust,ignore
Expand Down
Loading