web: Implement LocaleBackend for web
This commit is contained in:
parent
f50b29151c
commit
43f5506418
|
@ -3,14 +3,17 @@
|
|||
//! Ruffle web frontend.
|
||||
mod audio;
|
||||
mod input;
|
||||
mod locale;
|
||||
mod navigator;
|
||||
mod storage;
|
||||
|
||||
use crate::storage::LocalStorageBackend;
|
||||
use crate::{audio::WebAudioBackend, input::WebInputBackend, navigator::WebNavigatorBackend};
|
||||
use crate::{
|
||||
audio::WebAudioBackend, input::WebInputBackend, locale::WebLocaleBackend,
|
||||
navigator::WebNavigatorBackend,
|
||||
};
|
||||
use generational_arena::{Arena, Index};
|
||||
use js_sys::Uint8Array;
|
||||
use ruffle_core::backend::locale::NullLocaleBackend;
|
||||
use ruffle_core::backend::render::RenderBackend;
|
||||
use ruffle_core::backend::storage::MemoryStorageBackend;
|
||||
use ruffle_core::backend::storage::StorageBackend;
|
||||
|
@ -158,7 +161,7 @@ impl Ruffle {
|
|||
let audio = Box::new(WebAudioBackend::new()?);
|
||||
let navigator = Box::new(WebNavigatorBackend::new());
|
||||
let input = Box::new(WebInputBackend::new(&canvas));
|
||||
let locale = Box::new(NullLocaleBackend::new());
|
||||
let locale = Box::new(WebLocaleBackend::new());
|
||||
|
||||
let current_domain = window.location().href().unwrap();
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
use chrono::{DateTime, FixedOffset, Local, Offset, Utc};
|
||||
use ruffle_core::backend::locale::LocaleBackend;
|
||||
|
||||
pub struct WebLocaleBackend();
|
||||
|
||||
impl WebLocaleBackend {
|
||||
pub fn new() -> Self {
|
||||
Self()
|
||||
}
|
||||
}
|
||||
|
||||
impl LocaleBackend for WebLocaleBackend {
|
||||
fn get_current_date_time(&self) -> DateTime<Utc> {
|
||||
Utc::now()
|
||||
}
|
||||
|
||||
fn get_timezone(&self) -> FixedOffset {
|
||||
Local::now().offset().fix()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue