Skip to main content

convert_with_normalization

Function convert_with_normalization 

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

Convert like convert, with an option to normalize placeholders before writing.

When normalize is true, common iOS placeholder tokens like %@, %1$@, %ld are converted to canonical forms (%s, %1$s, %d) prior to serialization. Convert with optional placeholder normalization.

Example

use langcodec::formats::FormatType;
use langcodec::converter::convert_with_normalization;
convert_with_normalization(
    "en.lproj/Localizable.strings",
    FormatType::Strings(Some("en".to_string())),
    "values/strings.xml",
    FormatType::AndroidStrings(Some("en".to_string())),
    true, // normalize placeholders (e.g., %@ -> %s)
)?;