mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-10 21:11:15 -03:00
gettext.rs: allow translating non-literal strings
A following commit will pass global string constants to the gettext macro. This is not ideal because we might accidentally use the constants without gettext (which we should never do). To fix that we might need to define a macro per constant, or use a proc macro which is maybe not worth it.
This commit is contained in:
@@ -15,7 +15,7 @@ pub fn wgettext_impl_do_not_use_directly(text: &[wchar_t]) -> &'static wstr {
|
||||
/// Get a (possibly translated) string from a string literal.
|
||||
/// This returns a &'static wstr.
|
||||
macro_rules! wgettext {
|
||||
($string:literal) => {
|
||||
($string:expr) => {
|
||||
crate::wutil::gettext::wgettext_impl_do_not_use_directly(
|
||||
crate::wchar_ffi::u32cstr!($string).as_slice_with_nul(),
|
||||
)
|
||||
@@ -27,7 +27,7 @@ macro_rules! wgettext {
|
||||
/// The result is a WString.
|
||||
macro_rules! wgettext_fmt {
|
||||
(
|
||||
$string:literal, // format string
|
||||
$string:expr, // format string
|
||||
$($args:expr),* // list of expressions
|
||||
$(,)? // optional trailing comma
|
||||
) => {
|
||||
|
||||
Reference in New Issue
Block a user