Added Methods for KLocalizedString

This commit is contained in:
Ayush Singh 2021-12-15 22:24:45 +05:30
parent 4c2f78d2bb
commit 2cdd13d145
2 changed files with 17 additions and 1 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
/target
Cargo.lock
.idea

View file

@ -73,9 +73,24 @@ impl KLocalizedString {
}
/// Check whether the translation catalog file in the given language for the set application translation domain exists.
pub fn is_application_translated_into(language: &QString) -> bool {
pub fn is_application_translated_into(language: QString) -> bool {
cpp!(unsafe [language as "QString"] -> bool as "bool" {
return KLocalizedString::isApplicationTranslatedInto(language);
})
}
/// Find a path to the localized file for the given original path.
/// This is intended mainly for non-text resources (images, sounds, etc). Text resources should be handled in more specific ways.
pub fn localized_file_path(file_path: QString) -> QString {
cpp!(unsafe [file_path as "QString"] -> QString as "QString" {
return KLocalizedString::localizedFilePath(file_path);
})
}
/// Remove accelerator marker from a UI text label.
pub fn remove_accelerator_marker(label: QString) -> QString{
cpp!(unsafe [label as "QString"] -> QString as "QString" {
return KLocalizedString::removeAcceleratorMarker(label);
})
}
}