Skip to main content

convert

Function convert 

Source
pub fn convert<P: AsRef<Path>>(
    input: P,
    input_format: FormatType,
    output: P,
    output_format: FormatType,
) -> Result<(), Error>
Expand description

Convert a localization file from one format to another.

§Arguments

  • input - The input file path.
  • input_format - The format of the input file.
  • output - The output file path.
  • output_format - The format of the output file.

§Errors

Returns an Error if reading, parsing, converting, or writing fails.

§Example

use langcodec::{converter::convert, formats::FormatType};
convert(
    "Localizable.strings",
    FormatType::Strings(None),
    "strings.xml",
    FormatType::AndroidStrings(None),
)?;