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_buffered_reader(
&self,
lang_file: &Path,
) -> Result<Box<dyn BufRead>, Error>;
fn get_lang_reader(&self, lang_file: &Path) -> Result<Box<dyn Read>, 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>;
}Required Methods§
Sourcefn get_lang_files(&self, lang_path: &Path) -> Result<Vec<PathBuf>, Error>
fn get_lang_files(&self, lang_path: &Path) -> Result<Vec<PathBuf>, Error>
@param langPath Path to the folder @return Return all files inside the folder located at langPath
Sourcefn get_lang_path(&self, lang_file: &Path) -> Result<PathBuf, Error>
fn get_lang_path(&self, lang_file: &Path) -> Result<PathBuf, Error>
@param langFile Path to the file @return Return the canonical path of the file located at langFile
Sourcefn get_lang_file_name(&self, lang_file: &Path) -> Option<OsString>
fn get_lang_file_name(&self, lang_file: &Path) -> Option<OsString>
@param langFile Path to the file @return Return the file name of the file located at langFile
Sourcefn get_lang_buffered_reader(
&self,
lang_file: &Path,
) -> Result<Box<dyn BufRead>, Error>
fn get_lang_buffered_reader( &self, lang_file: &Path, ) -> Result<Box<dyn BufRead>, Error>
@param langFile Path to the file @return Return a reader for the file
Sourcefn get_lang_reader(&self, lang_file: &Path) -> Result<Box<dyn Read>, Error>
fn get_lang_reader(&self, lang_file: &Path) -> Result<Box<dyn Read>, Error>
@param langFile Path to the file @return Return an input stream for the file
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>
@param langFile Path to the file @param translationMap The Map of all translations @return Return true if successful else false (Return false if not implemented)
Sourcefn show_input_dialog(&self, text: &str) -> Result<String, NativeError>
fn show_input_dialog(&self, text: &str) -> Result<String, NativeError>
@param text The text prompt to be shown to the user @return Return the value inputed by the user @throws Exception Throw any exception if not implemented or if any other error occurred