Localize.Routes.LocalizedHelpers (Localize Web v0.7.0)

Copy Markdown View Source

Generates a module that implements localized route helpers.

At compile time, this module introspects the Phoenix-generated helpers module and creates wrapper functions that dispatch to the correct locale-specific helper based on the current locale. It also generates *_links functions that produce a map of locale-to-URL pairs suitable for hreflang link tags.

Summary

Functions

For a given set of routes, define a LocalizedHelpers module that implements localized helpers.

Generates HTML link tags for a given map of locale => URLs.

Types

locale_name()

@type locale_name() :: String.t()

url()

@type url() :: String.t()

Functions

define(env, routes, opts \\ [])

For a given set of routes, define a LocalizedHelpers module that implements localized helpers.

hreflang_links(url_map)

@spec hreflang_links(%{required(locale_name()) => url()}) :: Phoenix.HTML.safe()

Generates HTML link tags for a given map of locale => URLs.