Function getLanguageFromString

  • Finds the language code based on a given string representation of a language.

    Parameters

    • str: string

      The string representation of the language, this is case sensitive!

    Returns undefined | string

    The language code if found, otherwise undefined.

    Example

    expect(getLanguageFromString("Deutsch")).toBe("de");
    

    Example

    expect(getLanguageFromString("English")).toBe("en");
    

    Example

    expect(getLanguageFromString("日本語")).toBe("ja");
    

    Example

    expect(getLanguageFromString("no lang")).toBe(undefined);
    

Generated using TypeDoc