Extract Translator struct

This commit is contained in:
Cameron Steffen
2025-06-19 13:02:04 -05:00
parent 8de4c7234d
commit 07b9bb1855
18 changed files with 190 additions and 250 deletions

View File

@@ -41,14 +41,14 @@ fn test_positions(code: &str, span: (u32, u32), expected_output: SpanTestData) {
rustc_span::create_default_session_globals_then(|| {
let sm = Arc::new(SourceMap::new(FilePathMapping::empty()));
sm.new_source_file(Path::new("test.rs").to_owned().into(), code.to_owned());
let fallback_bundle =
crate::fallback_fluent_bundle(vec![crate::DEFAULT_LOCALE_RESOURCE], false);
let translator =
Translator::with_fallback_bundle(vec![crate::DEFAULT_LOCALE_RESOURCE], false);
let output = Arc::new(Mutex::new(Vec::new()));
let je = JsonEmitter::new(
Box::new(Shared { data: output.clone() }),
Some(sm),
fallback_bundle,
translator,
true, // pretty
HumanReadableErrorType::Short,
ColorConfig::Never,