pub trait PlatformAPI: Debug {
// Required methods
fn get_lang_files(&self, lang_path: &Path) -> Result<Vec<PathBuf>, Error>;
fn get_lang_path(&self, lang_file: &Path) -> Result<PathBuf, Error>;
fn get_lang_file_name(&self, lang_file: &Path) -> Option<OsString>;
fn get_lang_reader(&self, lang_file: &Path) -> Result<Box<[u8]>, Error>;
fn write_lang_file(
&self,
lang_file: &Path,
translation_map: HashMap<String, String>,
) -> Result<(), Error>;
fn show_input_dialog(&self, text: &str) -> Result<String, NativeError>;
// Provided methods
fn print(&mut self, text: &str) { ... }
fn println(&mut self, text: &str) { ... }
fn print_error(&mut self, text: &str) { ... }
fn println_error(&mut self, text: &str) { ... }
}
Expand description
This trait is used to abstract some io functionality
Required Methods§
Sourcefn get_lang_file_name(&self, lang_file: &Path) -> Option<OsString>
fn get_lang_file_name(&self, lang_file: &Path) -> Option<OsString>
Sourcefn write_lang_file(
&self,
lang_file: &Path,
translation_map: HashMap<String, String>,
) -> Result<(), Error>
fn write_lang_file( &self, lang_file: &Path, translation_map: HashMap<String, String>, ) -> Result<(), Error>
Writes a translation file
§Arguments
lang_file
- Path to the filetranslation_map
- The map of all translations