Skip to main content

generate_locale_redirect

Function generate_locale_redirect 

Source
pub fn generate_locale_redirect(
    site_dir: &Path,
    available_locales: &[String],
    default_locale: &str,
) -> Result<()>
Expand description

Generates a root index.html that reads the browser’s language preference and redirects to the best matching locale directory.

The file is written at site_dir/index.html. If it already exists and was not generated by this function, it is left untouched.

§Errors

Returns an error if the file cannot be written.