Bug 1921537 - Use fluent-ffi to properly adapt Rust fluent bundle to gecko. r=mkmelin
Differential Revision: https://phabricator.services.mozilla.com/D224007 --HG-- extra : amend_source : a7cf94a46be2073cbee4bfdc8c20a6ecda4da904
This commit is contained in:
Родитель
b07857e031
Коммит
bc6783327c
|
@ -5143,6 +5143,7 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"cstr",
|
||||
"fluent",
|
||||
"fluent-ffi",
|
||||
"ksni",
|
||||
"log",
|
||||
"moz_task",
|
||||
|
|
|
@ -14,6 +14,7 @@ nsstring = { path = "../../../xpcom/rust/nsstring" }
|
|||
thin-vec = "0.2"
|
||||
unic-langid = "0.9"
|
||||
xpcom = { path = "../../../xpcom/rust/xpcom" }
|
||||
fluent-ffi = { path = "../../../intl/l10n/rust/fluent-ffi" }
|
||||
|
||||
[target.'cfg(all(target_os = "linux", target_arch = "x86_64"))'.dependencies]
|
||||
ksni = "0.2.2"
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use fluent::FluentBundle;
|
||||
use fluent_ffi::{adapt_bundle_for_gecko, FluentBundleRc};
|
||||
use ksni::Handle;
|
||||
use nserror::{nsresult, NS_OK};
|
||||
use std::os::raw::c_void;
|
||||
use std::rc::Rc;
|
||||
use system_tray::{SystemTray, TrayItem, XdgIcon};
|
||||
use xpcom::{nsIID, xpcom_method, RefPtr};
|
||||
|
||||
|
@ -41,9 +42,11 @@ impl LinuxSysTrayHandler {
|
|||
pub fn new() -> RefPtr<LinuxSysTrayHandler> {
|
||||
let locs = locales::app_locales().expect("Failed to retrieve application locales");
|
||||
let resource = locales::fl_resource().expect("Failed to parse fluent templates");
|
||||
let mut bundle = FluentBundle::new(locs);
|
||||
let mut bundle = FluentBundleRc::new(locs);
|
||||
adapt_bundle_for_gecko(&mut bundle, None);
|
||||
|
||||
bundle
|
||||
.add_resource(resource)
|
||||
.add_resource(Rc::new(resource))
|
||||
.expect("Failed to add resources to bundle");
|
||||
|
||||
// Grab the quit message
|
||||
|
|
Загрузка…
Ссылка в новой задаче