core: Rename text to core_text just to avoid confusion if used from another crate with its own text methods

This commit is contained in:
Nathan Adams 2023-04-24 13:54:49 +02:00
parent 9c2e77c88f
commit fd5a7cdbc2
2 changed files with 13 additions and 13 deletions

View File

@ -8,7 +8,7 @@ use crate::avm1;
use crate::avm2;
use crate::display_object::Stage;
use crate::display_object::TDisplayObject;
use crate::i18n::text;
use crate::i18n::core_text;
use fluent_templates::LanguageIdentifier;
use gc_arena::Collect;
use ruffle_render::quality::StageQuality;
@ -50,7 +50,7 @@ impl<'gc> ContextMenuState<'gc> {
ContextMenuItem {
enabled: true,
separator_before: true,
caption: text(language, "context-menu-play"),
caption: core_text(language, "context-menu-play"),
checked: is_playing_root_movie,
},
ContextMenuCallback::Play,
@ -62,7 +62,7 @@ impl<'gc> ContextMenuState<'gc> {
ContextMenuItem {
enabled: !is_first_frame,
separator_before: true,
caption: text(language, "context-menu-rewind"),
caption: core_text(language, "context-menu-rewind"),
checked: false,
},
ContextMenuCallback::Rewind,
@ -74,7 +74,7 @@ impl<'gc> ContextMenuState<'gc> {
ContextMenuItem {
enabled: true,
separator_before: false,
caption: text(language, "context-menu-forward"),
caption: core_text(language, "context-menu-forward"),
checked: false,
},
ContextMenuCallback::Forward,
@ -83,7 +83,7 @@ impl<'gc> ContextMenuState<'gc> {
ContextMenuItem {
enabled: !is_first_frame,
separator_before: false,
caption: text(language, "context-menu-back"),
caption: core_text(language, "context-menu-back"),
checked: false,
},
ContextMenuCallback::Back,
@ -96,7 +96,7 @@ impl<'gc> ContextMenuState<'gc> {
enabled: stage.quality() != StageQuality::Low,
separator_before: true,
checked: stage.quality() == StageQuality::Low,
caption: text(language, "context-menu-quality-low"),
caption: core_text(language, "context-menu-quality-low"),
},
ContextMenuCallback::QualityLow,
);
@ -105,7 +105,7 @@ impl<'gc> ContextMenuState<'gc> {
enabled: stage.quality() != StageQuality::Medium,
separator_before: false,
checked: stage.quality() == StageQuality::Medium,
caption: text(language, "context-menu-quality-medium"),
caption: core_text(language, "context-menu-quality-medium"),
},
ContextMenuCallback::QualityMedium,
);
@ -114,7 +114,7 @@ impl<'gc> ContextMenuState<'gc> {
enabled: stage.quality() != StageQuality::High,
separator_before: false,
checked: stage.quality() == StageQuality::High,
caption: text(language, "context-menu-quality-high"),
caption: core_text(language, "context-menu-quality-high"),
},
ContextMenuCallback::QualityHigh,
);

View File

@ -3,20 +3,20 @@ use fluent_templates::{static_loader, LanguageIdentifier, Loader};
use std::collections::HashMap;
static_loader! {
pub static TEXTS = {
static TEXTS = {
locales: "./assets/texts",
fallback_language: "en-US"
};
}
pub fn text(language: &LanguageIdentifier, id: &str) -> String {
pub fn core_text(language: &LanguageIdentifier, id: &str) -> String {
TEXTS.lookup(language, id).unwrap_or_else(|| {
tracing::error!("Unknown text id '{id}'");
tracing::error!("Unknown core text id '{id}'");
id.to_string()
})
}
pub fn text_with_args<T: AsRef<str>>(
pub fn core_text_with_args<T: AsRef<str>>(
language: &LanguageIdentifier,
id: &str,
args: &HashMap<T, FluentValue>,
@ -24,7 +24,7 @@ pub fn text_with_args<T: AsRef<str>>(
TEXTS
.lookup_with_args(language, id, args)
.unwrap_or_else(|| {
tracing::error!("Unknown text id '{id}'");
tracing::error!("Unknown core text id '{id}'");
id.to_string()
})
}