Skip to content

Locale::from_name on de-DE or en-US #45

@GunnarBernsteinHH

Description

@GunnarBernsteinHH

I am not sure if this is intended behavior.

When I try to use the locale, I am idendifying it automatically like

let current_locale = sys_locale::get_locale().unwrap_or_else(|| String::from("en-US"));

This produces de-DE or en-US.

But:

    let a = Locale::from_name("de-CH"); // ok
    let b = Locale::from_name("de-DE"); // not found, here only 'de' can be used
    let c = Locale::from_name("en-US"); // not found, here only 'en' can be used
    let d = Locale::from_name("en-HK"); // ok

It would be nice if the crate would automatically fallback to the 2 digit allowed locale.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions