mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Bundle translations (#6661)
This currently doesn't have public API to enable it yet. TODO: - Error handling in the compiler - Public API in the compiler configuration - Documentation
This commit is contained in:
parent
2f62c60e3c
commit
95f5685789
23 changed files with 1163 additions and 15 deletions
|
@ -190,6 +190,15 @@ pub enum Expression {
|
|||
},
|
||||
|
||||
EmptyComponentFactory,
|
||||
|
||||
/// A reference to bundled translated string
|
||||
TranslationReference {
|
||||
/// An expression of type array of strings
|
||||
format_args: Box<Expression>,
|
||||
string_index: usize,
|
||||
/// The `n` value to use for the plural form if it is a plural form
|
||||
plural: Option<Box<Expression>>,
|
||||
},
|
||||
}
|
||||
|
||||
impl Expression {
|
||||
|
@ -306,6 +315,7 @@ impl Expression {
|
|||
}
|
||||
Self::MinMax { ty, .. } => ty.clone(),
|
||||
Self::EmptyComponentFactory => Type::ComponentFactory,
|
||||
Self::TranslationReference { .. } => Type::String,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -388,6 +398,12 @@ macro_rules! visit_impl {
|
|||
$visitor(rhs);
|
||||
}
|
||||
Expression::EmptyComponentFactory => {}
|
||||
Expression::TranslationReference { format_args, plural, string_index: _ } => {
|
||||
$visitor(format_args);
|
||||
if let Some(plural) = plural {
|
||||
$visitor(plural);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue