Skip to content

Releases: elixir-cldr/cldr_routes

Cldr Routes version 1.2.0

03 Jan 04:14
Compare
Choose a tag to compare

Planned Release 2.0.0

  • Following the introduction of Phoenix 1.7 and PhoenixHTML version 4.0.0, helpers are no longer generated. The next version of :ex_cldr_routes will also omit helper generation. It is anticpated this 2.0 release will land by the end of March 2024.

Enhancements

  • Configures :phoenix_html_helpers as a dependency rather than the full :phoenix app. :ex_cldr_routes only uses the tag helper which is now hosted in the new library. Whilst deprecated within Phoenix, its use here is to generate hreflang headers.

Cldr Routes version 1.1.0

09 May 10:03
Compare
Choose a tag to compare

Bug Fixes

  • Fix Phoenix integration which was failing to compile when using Phoenix auth. Thanks to @rubas for the report and collaboration.

  • Fix dialyzer error. Thanks to @rubas for the report.

Deprecation

  • The module Cldr.Route is renamed to Cldr.Routes to better match Phoenix naming. As a result, the provider module to be added to a Cldr backend configuration is now Cldr.Routes, not Cldr.Route. Cldr.Route remains for now and if used will issue a deprecation warning.

Cldr Routes version 1.0.0

03 May 10:00
Compare
Choose a tag to compare

Enhancements

  • Supports localized verified routes with ~q (Sigil_q).

  • Supports Phoenix 1.7 and later only.

  • Supports Elixir 1.11 and later only.

Cldr Routes version 0.6.4

29 Apr 10:59
Compare
Choose a tag to compare

Bug Fixes

  • Fixes route :as option to correctly stringify atom names. Closes #14. Thanks to @krns for the report.

Cldr Routes version 0.6.3

27 Apr 07:00
Compare
Choose a tag to compare

Bug Fixes

  • Fix readme example. Thanks to @krns for the PR. Closes #12.

  • Support Phoenix 1.7. NOTE: Doesn't yet include localized verified routes.

Cldr Routes version 0.6.2

05 Aug 22:23
Compare
Choose a tag to compare

Bug Fixes

  • Uses the standard Phoenix tag helper to generate hreflang helpers.

Cldr Routes version 0.6.1

24 Jul 04:13
Compare
Choose a tag to compare

Bug Fixes

  • Fix LocalizedHelpers.hreflang_links/1 to return an empty string if links is nil.

Cldr Routes version 0.6.0

24 Jul 02:25
Compare
Choose a tag to compare

Enhancements

  • Adds MyApp.Router.LocalizedHelpers.<helper>_links functions to the generated LocalizedHelpers module. These _links functions are 1:1 correspondents to the _path and _url helpers. The _link helpers generate link headers that help identify the other language versions of a page. They are used like this:
iex> alias MyApp.Router.LocalizedHelpers, as: Routes
iex> Routes.user_links(conn, :show, 1) |> Routes.hreflang_links()
{
 :safe,
 [
   ["<link href=", "\"http://localhost/users_de/1\"", "; rel=alternate; hreflang=", "\"de\"", " />"],
   "\n",
   ["<link href=", "\"http://localhost/users/1\"", "; rel=alternate; hreflang=", "\"en\"", " />"],
   "\n",
   ["<link href=", "\"http://localhost/users_fr/1\"", "; rel=alternate; hreflang=", "\"fr\"", " />"]
  ]
}

Cldr Routes version 0.5.0

22 Jul 01:00
Compare
Choose a tag to compare

Bug Fixes

  • Propogate locales on the localize macro to nested resources

Breaking change

  • The locale is now stored in the :private field of the conn for both live routes and other routes. It was previously stored in the :assigns field for non-live routes.

Cldr Routes version 0.3.0

17 Jul 14:05
Compare
Choose a tag to compare

Enhancements

  • Add support for live routes. Thanks to @ringofhealth for the report. Closes #1.

  • Support interpolating locale, language and territory into a route. Thanks to @rubas for the suggestion. Closes #3. For example:

  localize do
    get "/#{locale}/locale/pages/:page", PageController, :show, as: "with_locale"
    get "/#{language}/language/pages/:page", PageController, :show, as: "with_language"
    get "/#{territory}/territory/pages/:page", PageController, :show, as: "with_territory"
  end
  • Uses the macros from Gettext rather than the functions when generating routes. This means that the mix tasks gettext.extract and gettext.merge now work as expected. Closes #3.

  • Rewrite the LocalizedHelpers module that now proxies into the standard Phoenix Helpers module rather than maintaining a separate forked module. As a result:

    • The standard Helpers module now generates helper names that have locale suffixes. That is user_path becomes user_en_path, user_fr_path and so on.
    • The LocalizedHelpers module hosts the standard helper names (like user_path) which will then call the appropriate standard helper depending on the result of Cldr.get_locale/1.
  • Add functions to output the localised routes. At compile time a module called MyApp.Router.LocalizedRoutes is created. This module hosts a __routes__/0 function which can be passed as an argument to the Phoenix standard Phoenix.Router.ConsoleFormatter.format/1 function that returns a string representation of configured localized routes. These can then be IO.puts/1 as required. In the next release a mix task will automate this process.

Thanks to @rubas and @ringofhealth for their extreme patience while I worked this through. Closes #1, and #4.