Upgraded Leptos to 0.8. Fixes #1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
use lazy_static::lazy_static;
|
||||
use leptos::*;
|
||||
use leptos::prelude::*;
|
||||
use crate::locales::Locales;
|
||||
|
||||
lazy_static! {
|
||||
@@ -182,16 +182,15 @@ lazy_static! {
|
||||
};
|
||||
}
|
||||
|
||||
fn get_locales() -> Vec<Option<String>> {
|
||||
pub fn get_locales() -> Vec<Option<String>> {
|
||||
#[cfg(not(feature = "ssr"))]
|
||||
{
|
||||
use_context::<Locales>().unwrap_or(Locales(vec![])).0
|
||||
// Context is not available in event handlers, ask the browser there
|
||||
use_context::<Locales>().unwrap_or_else(crate::locales::browser_locales).0
|
||||
}
|
||||
#[cfg(feature = "ssr")]
|
||||
{
|
||||
use actix_web::HttpRequest;
|
||||
|
||||
let req = use_context::<HttpRequest>();
|
||||
let req = use_context::<leptos_actix::Request>();
|
||||
if let Some(r) = req {
|
||||
if let Some(al) = r.head().headers.get("accept-language") {
|
||||
Locales(al.to_str().unwrap_or("").split(",").map(|l| Some(l.to_string())).collect()).0
|
||||
|
||||
Reference in New Issue
Block a user