Function rust_i18n_support::minify_key

source ·
pub fn minify_key<'r>(
    value: &'r str,
    len: usize,
    prefix: &str,
    threshold: usize,
) -> Cow<'r, str>
Expand description

Generate a translation key from a value.

§Arguments

  • value - The value to be generated.
  • len - The length of the translation key.
  • prefix - The prefix of the translation key.
  • threshold - The minimum length of the value to be generated.

§Returns

  • If value.len() <= threshold then returns the origin value.
  • Otherwise, returns a base62 encoded 128 bits hashed translation key.