diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cad7175..3ebe8bf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## [v3.0.0](https://github.com/mojotech/torch/tree/v3.0.0) (2020-02-07) + +[Full Changelog](https://github.com/mojotech/torch/compare/v2.1.0...v3.0.0) + +** Note ** + +Explicit support for Elixir 1.5, 1.6 and 1.7 was dropped. Torch was not testing +against these older versions in CI, and while Torch currently will still work on +those versions, we are explicity dropping official support for them since we do +not and will not be testing the builds against them. + +This is why the major version number of Torch was jumped from 2.x to 3.x. The +new 3.x version is still fully backwards-compatible with the 2.x version; we +only bumped the major version number to be explicit about the change of +supported Elixir runtimes. + +**Merged pull requests:** + +- Add new date filter options and input [\#134](https://github.com/mojotech/torch/pull/134) ([cpjolicoeur](https://github.com/cpjolicoeur)) + ## [v2.1.0](https://github.com/mojotech/torch/tree/v2.1.0) (2020-01-06) [Full Changelog](https://github.com/mojotech/torch/compare/v2.0.0...v2.1.0) diff --git a/README.md b/README.md index e62db135..6677d58a 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ To install Torch, perform the following steps: ```elixir def deps do [ - {:torch, "~> 2.0"} + {:torch, "~> 3.0"} ] end ``` @@ -168,3 +168,42 @@ above. Just change the stylesheet link in the `torch.html.eex` layout. If you want to use the theme, but override the colors, you'll need to include your own stylesheet with the specific overrides. + +## Internationalization + +Torch comes with `.po` files for `en`, `ru` and `es` locales. If you are using +torch and can provide us with translation files for other languages, please +submit a Pull Request with the translation file. We'd love to add as many +translations as possible. + +If you wish to add your own customized translations, you can configure Torch to +use your own custom `MessagesBackend` and adding it in your Torch configuration +settings in `config.exs`. You can find the all messages that can be customized +in the default [i18n/backend.ex](lib/torch/i18n/backend.ex) file. + +If you are customizing a backend for a "standard" spoken language, please submit +back a proper `.po` translation file for us to include in the official Torch +releases so other users can take advantage. + +**Example** + +```elixir +defmodule MyApp.CustomMessagesBackend do + def message("Contains"), do: "** CUSTOM Contains **" + def message("Equals"), do: "** CUSTOM Equals ****" + def message("< Prev"), do: "<--" + def message("Next >"), do: "-->" + + # You can add a fallback so it won't break with newly added messages or + # messages you did not customize + def message(text), do: Torch.I18n.Backend.message(text) +end +``` + +```elixir +# config.exs +config :torch, + otp_app: :my_app_name, + i18n_backend: MyApp.CustomMessagesBackend + template_format: "eex" || "slim" +``` diff --git a/lib/torch/config.ex b/lib/torch/config.ex index de5207df..e3e4aaa5 100644 --- a/lib/torch/config.ex +++ b/lib/torch/config.ex @@ -10,4 +10,8 @@ defmodule Torch.Config do def template_format do Application.get_env(:torch, :template_format) end + + def i18n_backend do + Application.get_env(:torch, :i18n_backend, Torch.I18n.Backend) + end end diff --git a/lib/torch/i18n.ex b/lib/torch/i18n.ex new file mode 100644 index 00000000..67f32c03 --- /dev/null +++ b/lib/torch/i18n.ex @@ -0,0 +1,9 @@ +defmodule Torch.I18n do + @moduledoc """ + Provides internationalization support for Torch apps using standard + Gettext features as a default, but also allows Torch users to customize + their own "messaging backends" for custom i18n support. + """ + + def message(text_key), do: Torch.Config.i18n_backend().message(text_key) +end diff --git a/lib/torch/i18n/backend.ex b/lib/torch/i18n/backend.ex new file mode 100644 index 00000000..bcbcdf11 --- /dev/null +++ b/lib/torch/i18n/backend.ex @@ -0,0 +1,24 @@ +defmodule Torch.I18n.Backend do + @moduledoc """ + Provides messages for different parts of the package. Can + also be overridden to include custom translations. + """ + + import Torch.Gettext, only: [dgettext: 2] + + def message("Contains"), do: dgettext("default", "Contains") + def message("Equals"), do: dgettext("default", "Equals") + def message("Choose one"), do: dgettext("default", "Choose one") + def message("Before"), do: dgettext("default", "Before") + def message("After"), do: dgettext("default", "After") + def message("Greater Than"), do: dgettext("default", "Greater Than") + def message("Greater Than Or Equal"), do: dgettext("default", "Greater Than Or Equal") + def message("Less Than"), do: dgettext("default", "Less Than") + def message("start"), do: dgettext("default", "start") + def message("end"), do: dgettext("default", "end") + def message("Select Date"), do: dgettext("default", "Select Date") + def message("Select Start Date"), do: dgettext("default", "Select Start Date") + def message("Select End Date"), do: dgettext("default", "Select End Date") + def message("< Prev"), do: dgettext("default", "< Prev") + def message("Next >"), do: dgettext("default", "Next >") +end diff --git a/lib/torch/views/filter_view.ex b/lib/torch/views/filter_view.ex index 54c7fe63..4eab453d 100644 --- a/lib/torch/views/filter_view.ex +++ b/lib/torch/views/filter_view.ex @@ -5,7 +5,7 @@ defmodule Torch.FilterView do use Phoenix.HTML - import Torch.Gettext, only: [dgettext: 2] + import Torch.I18n, only: [message: 1] @type prefix :: atom | String.t() @type field :: atom | String.t() @@ -27,7 +27,7 @@ defmodule Torch.FilterView do :"#{field}_equals", options, value: params[to_string(prefix)]["#{field}_equals"], - prompt: dgettext("default", "Choose one") + prompt: message("Choose one") ) end @@ -47,8 +47,8 @@ defmodule Torch.FilterView do {selected, _value} = find_param(params[prefix_str], field) opts = [ - {dgettext("default", "Contains"), "#{prefix}[#{field}_contains]"}, - {dgettext("default", "Equals"), "#{prefix}[#{field}_equals]"} + {message("Contains"), "#{prefix}[#{field}_contains]"}, + {message("Equals"), "#{prefix}[#{field}_equals]"} ] select(:filters, "", opts, class: "filter-type", value: "#{prefix}[#{selected}]") @@ -70,8 +70,8 @@ defmodule Torch.FilterView do {selected, _value} = find_param(params[prefix_str], field) opts = [ - {dgettext("default", "Before"), "#{prefix}[#{field}_before]"}, - {dgettext("default", "After"), "#{prefix}[#{field}_after]"} + {message("Before"), "#{prefix}[#{field}_before]"}, + {message("After"), "#{prefix}[#{field}_after]"} ] select(:filters, "", opts, class: "filter-type", value: "#{prefix}[#{selected}]") @@ -92,10 +92,10 @@ defmodule Torch.FilterView do {selected, _value} = find_param(params[prefix_str], field) opts = [ - {dgettext("default", "Equals"), "#{prefix}[#{field}_equals]"}, - {dgettext("default", "Greater Than"), "#{prefix}[#{field}_greater_than]"}, - {dgettext("default", "Greater Than Or Equal"), "#{prefix}[#{field}_greater_than_or]"}, - {dgettext("default", "Less Than"), "#{prefix}[#{field}_less_than]"} + {message("Equals"), "#{prefix}[#{field}_equals]"}, + {message("Greater Than"), "#{prefix}[#{field}_greater_than]"}, + {message("Greater Than Or Equal"), "#{prefix}[#{field}_greater_than_or]"}, + {message("Less Than"), "#{prefix}[#{field}_less_than]"} ] select(:filters, "", opts, class: "filter-type", value: "#{prefix}[#{selected}]") @@ -174,14 +174,14 @@ defmodule Torch.FilterView do torch_date_input( "#{prefix}[#{field}_between][start]", get_in(params, [prefix, "#{field}_between", "start"]), - dgettext("default", "start") + message("start") ) {:safe, ending} = torch_date_input( "#{prefix}[#{field}_between][end]", get_in(params, [prefix, "#{field}_between", "end"]), - dgettext("default", "end") + message("end") ) raw(start ++ ending) @@ -227,7 +227,7 @@ defmodule Torch.FilterView do class: "datepicker", name: name, value: value, - placeholder: dgettext("default", "Select Date") + placeholder: message("Select Date") ) end @@ -238,7 +238,7 @@ defmodule Torch.FilterView do class: "datepicker start", name: name, value: value, - placeholder: dgettext("default", "Select Start Date") + placeholder: message("Select Start Date") ) end @@ -249,7 +249,7 @@ defmodule Torch.FilterView do class: "datepicker end", name: name, value: value, - placeholder: dgettext("default", "Select End Date") + placeholder: message("Select End Date") ) end diff --git a/lib/torch/views/pagination_view.ex b/lib/torch/views/pagination_view.ex index 6249c399..5ba6c8dd 100644 --- a/lib/torch/views/pagination_view.ex +++ b/lib/torch/views/pagination_view.ex @@ -6,7 +6,7 @@ defmodule Torch.PaginationView do use Phoenix.View, root: "lib/torch/templates" use Phoenix.HTML - import Torch.Gettext, only: [dgettext: 2] + import Torch.I18n, only: [message: 1] import Torch.TableView @doc """ @@ -26,7 +26,7 @@ defmodule Torch.PaginationView do """ def prev_link(conn, current_page, sort_opts \\ nil) do if current_page != 1 do - link(dgettext("default", "< Prev"), + link(message("< Prev"), to: "?" <> querystring(conn, page: current_page - 1, sort_opts: sort_opts) ) end @@ -46,7 +46,7 @@ defmodule Torch.PaginationView do """ def next_link(conn, current_page, num_pages, sort_opts \\ nil) do if current_page != num_pages do - link(dgettext("default", "Next >"), + link(message("Next >"), to: "?" <> querystring(conn, page: current_page + 1, sort_opts: sort_opts) ) end diff --git a/mix.exs b/mix.exs index e49201f8..66db478a 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Torch.MixProject do def project do [ app: :torch, - version: "3.0.0", + version: "3.1.0", elixir: "~> 1.8", start_permanent: Mix.env() == :prod, compilers: [:phoenix, :gettext] ++ Mix.compilers(), diff --git a/mix.lock b/mix.lock index 86ddc7c0..05b8422c 100644 --- a/mix.lock +++ b/mix.lock @@ -1,39 +1,39 @@ %{ - "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"}, - "certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"}, - "combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm"}, - "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm"}, - "credo": {:hex, :credo, "1.1.5", "caec7a3cadd2e58609d7ee25b3931b129e739e070539ad1a0cd7efeeb47014f4", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"}, - "db_connection": {:hex, :db_connection, "2.0.5", "ddb2ba6761a08b2bb9ca0e7d260e8f4dd39067426d835c24491a321b7f92a4da", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm"}, - "decimal": {:hex, :decimal, "1.8.0", "ca462e0d885f09a1c5a342dbd7c1dcf27ea63548c65a65e67334f4b61803822e", [], [], "hexpm"}, - "earmark": {:hex, :earmark, "1.4.0", "397e750b879df18198afc66505ca87ecf6a96645545585899f6185178433cc09", [:mix], [], "hexpm"}, - "ecto": {:hex, :ecto, "3.0.6", "d33ab5b3f7553a41507d4b0ad5bf192d533119c4ad08f3a5d63d85aa12117dc9", [:mix], [{:decimal, "~> 1.6", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}], "hexpm"}, - "ecto_sql": {:hex, :ecto_sql, "3.0.4", "e7a0feb0b2484b90981c56d5cd03c52122c1c31ded0b95ed213b7c5c07ae6737", [:mix], [{:db_connection, "~> 2.0", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.0.6", [hex: :ecto, repo: "hexpm", optional: false]}, {:mariaex, "~> 0.9.1", [hex: :mariaex, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.14.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.3.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm"}, - "ex_doc": {:hex, :ex_doc, "0.21.2", "caca5bc28ed7b3bdc0b662f8afe2bee1eedb5c3cf7b322feeeb7c6ebbde089d6", [:mix], [{:earmark, "~> 1.3.3 or ~> 1.4", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"}, - "excoveralls": {:hex, :excoveralls, "0.12.1", "a553c59f6850d0aff3770e4729515762ba7c8e41eedde03208182a8dc9d0ce07", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"}, - "filtrex": {:hex, :filtrex, "0.4.3", "d59e496d385b19df7e3a613ad74deca4ac5ef1666352e9e435e8442fc9ae4c70", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.0", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:timex, "~> 3.1", [hex: :timex, repo: "hexpm", optional: false]}], "hexpm"}, - "gettext": {:hex, :gettext, "0.17.1", "8baab33482df4907b3eae22f719da492cee3981a26e649b9c2be1c0192616962", [:mix], [], "hexpm"}, - "hackney": {:hex, :hackney, "1.15.2", "07e33c794f8f8964ee86cebec1a8ed88db5070e52e904b8f12209773c1036085", [:rebar3], [{:certifi, "2.5.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.5", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"}, - "idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"}, - "jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"}, - "makeup": {:hex, :makeup, "1.0.0", "671df94cf5a594b739ce03b0d0316aa64312cee2574b6a44becb83cd90fb05dc", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"}, - "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm"}, - "mime": {:hex, :mime, "1.3.1", "30ce04ab3175b6ad0bdce0035cba77bba68b813d523d1aac73d9781b4d193cf8", [:mix], [], "hexpm"}, - "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm"}, - "nimble_parsec": {:hex, :nimble_parsec, "0.5.1", "c90796ecee0289dbb5ad16d3ad06f957b0cd1199769641c961cfe0b97db190e0", [:mix], [], "hexpm"}, - "parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm"}, - "phoenix": {:hex, :phoenix, "1.3.4", "aaa1b55e5523083a877bcbe9886d9ee180bf2c8754905323493c2ac325903dc5", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.3.3 or ~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"}, - "phoenix_html": {:hex, :phoenix_html, "2.13.3", "850e292ff6e204257f5f9c4c54a8cb1f6fbc16ed53d360c2b780a3d0ba333867", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"}, - "phoenix_pubsub": {:hex, :phoenix_pubsub, "1.1.1", "6668d787e602981f24f17a5fbb69cc98f8ab085114ebfac6cc36e10a90c8e93c", [:mix], [], "hexpm"}, - "plug": {:hex, :plug, "1.7.2", "d7b7db7fbd755e8283b6c0a50be71ec0a3d67d9213d74422d9372effc8e87fd1", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}], "hexpm"}, - "plug_crypto": {:hex, :plug_crypto, "1.0.0", "18e49317d3fa343f24620ed22795ec29d4a5e602d52d1513ccea0b07d8ea7d4d", [:mix], [], "hexpm"}, - "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"}, - "scrivener": {:hex, :scrivener, "2.5.0", "e1f78c62b6806d91cc9c4778deef1ea4e80aa9fadfce2c16831afe0468cc8a2c", [:mix], [], "hexpm"}, - "scrivener_ecto": {:hex, :scrivener_ecto, "2.0.0", "e6ee5cc49b44e6115029185f07ffddd7e78475aa40394e98219800fed18f8e42", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:scrivener, "~> 2.4", [hex: :scrivener, repo: "hexpm", optional: false]}], "hexpm"}, - "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.5", "6eaf7ad16cb568bb01753dbbd7a95ff8b91c7979482b95f38443fe2c8852a79b", [:make, :mix, :rebar3], [], "hexpm"}, - "telemetry": {:hex, :telemetry, "0.3.0", "099a7f3ce31e4780f971b4630a3c22ec66d22208bc090fe33a2a3a6a67754a73", [:rebar3], [], "hexpm"}, - "timex": {:hex, :timex, "3.5.0", "b0a23167da02d0fe4f1a4e104d1f929a00d348502b52432c05de875d0b9cffa5", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 0.1.8 or ~> 0.5", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm"}, - "tzdata": {:hex, :tzdata, "0.5.19", "7962a3997bf06303b7d1772988ede22260f3dae1bf897408ebdac2b4435f4e6a", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"}, - "unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm"}, + "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, + "certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "805abd97539caf89ec6d4732c91e62ba9da0cda51ac462380bbd28ee697a8c42"}, + "combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"}, + "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm", "4a0850c9be22a43af9920a71ab17c051f5f7d45c209e40269a1938832510e4d9"}, + "credo": {:hex, :credo, "1.1.5", "caec7a3cadd2e58609d7ee25b3931b129e739e070539ad1a0cd7efeeb47014f4", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "d0bbd3222607ccaaac5c0340f7f525c627ae4d7aee6c8c8c108922620c5b6446"}, + "db_connection": {:hex, :db_connection, "2.0.5", "ddb2ba6761a08b2bb9ca0e7d260e8f4dd39067426d835c24491a321b7f92a4da", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm", "ced0780bed50430f770b74fcde870c4a50c815124ecf9fee20d67a465966eb4f"}, + "decimal": {:hex, :decimal, "1.8.0", "ca462e0d885f09a1c5a342dbd7c1dcf27ea63548c65a65e67334f4b61803822e", [:mix], [], "hexpm", "52694ef56e60108e5012f8af9673874c66ed58ac1c4fae9b5b7ded31786663f5"}, + "earmark": {:hex, :earmark, "1.4.0", "397e750b879df18198afc66505ca87ecf6a96645545585899f6185178433cc09", [:mix], [], "hexpm", "4bedcec35de03b5f559fd2386be24d08f7637c374d3a85d3fe0911eecdae838a"}, + "ecto": {:hex, :ecto, "3.0.6", "d33ab5b3f7553a41507d4b0ad5bf192d533119c4ad08f3a5d63d85aa12117dc9", [:mix], [{:decimal, "~> 1.6", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}], "hexpm", "0e3761e75c87affe9f5e7735d285185c2942ccb0808ca82fb35963f55c31c7b5"}, + "ecto_sql": {:hex, :ecto_sql, "3.0.4", "e7a0feb0b2484b90981c56d5cd03c52122c1c31ded0b95ed213b7c5c07ae6737", [:mix], [{:db_connection, "~> 2.0", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.0.6", [hex: :ecto, repo: "hexpm", optional: false]}, {:mariaex, "~> 0.9.1", [hex: :mariaex, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.14.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.3.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7b49acc82d34fc1e020dbf8bebaff8f1dff40b550d778743943beba4190e4db5"}, + "ex_doc": {:hex, :ex_doc, "0.21.2", "caca5bc28ed7b3bdc0b662f8afe2bee1eedb5c3cf7b322feeeb7c6ebbde089d6", [:mix], [{:earmark, "~> 1.3.3 or ~> 1.4", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "f1155337ae17ff7a1255217b4c1ceefcd1860b7ceb1a1874031e7a861b052e39"}, + "excoveralls": {:hex, :excoveralls, "0.12.1", "a553c59f6850d0aff3770e4729515762ba7c8e41eedde03208182a8dc9d0ce07", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "5c1f717066a299b1b732249e736c5da96bb4120d1e55dc2e6f442d251e18a812"}, + "filtrex": {:hex, :filtrex, "0.4.3", "d59e496d385b19df7e3a613ad74deca4ac5ef1666352e9e435e8442fc9ae4c70", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.0", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:timex, "~> 3.1", [hex: :timex, repo: "hexpm", optional: false]}], "hexpm", "a374999d00174c3a6c617def9c9d199a2bc5928d49a227d1de622ccbadbff1d0"}, + "gettext": {:hex, :gettext, "0.17.1", "8baab33482df4907b3eae22f719da492cee3981a26e649b9c2be1c0192616962", [:mix], [], "hexpm", "f7d97341e536f95b96eef2988d6d4230f7262cf239cda0e2e63123ee0b717222"}, + "hackney": {:hex, :hackney, "1.15.2", "07e33c794f8f8964ee86cebec1a8ed88db5070e52e904b8f12209773c1036085", [:rebar3], [{:certifi, "2.5.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.5", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "e0100f8ef7d1124222c11ad362c857d3df7cb5f4204054f9f0f4a728666591fc"}, + "idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "4bdd305eb64e18b0273864920695cb18d7a2021f31a11b9c5fbcd9a253f936e2"}, + "jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fdf843bca858203ae1de16da2ee206f53416bbda5dc8c9e78f43243de4bc3afe"}, + "makeup": {:hex, :makeup, "1.0.0", "671df94cf5a594b739ce03b0d0316aa64312cee2574b6a44becb83cd90fb05dc", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "a10c6eb62cca416019663129699769f0c2ccf39428b3bb3c0cb38c718a0c186d"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "d4b316c7222a85bbaa2fd7c6e90e37e953257ad196dc229505137c5e505e9eff"}, + "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, + "mime": {:hex, :mime, "1.3.1", "30ce04ab3175b6ad0bdce0035cba77bba68b813d523d1aac73d9781b4d193cf8", [:mix], [], "hexpm", "6cbe761d6a0ca5a31a0931bf4c63204bceb64538e664a8ecf784a9a6f3b875f1"}, + "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, + "nimble_parsec": {:hex, :nimble_parsec, "0.5.1", "c90796ecee0289dbb5ad16d3ad06f957b0cd1199769641c961cfe0b97db190e0", [:mix], [], "hexpm", "00e3ebdc821fb3a36957320d49e8f4bfa310d73ea31c90e5f925dc75e030da8f"}, + "parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm", "17ef63abde837ad30680ea7f857dd9e7ced9476cdd7b0394432af4bfc241b960"}, + "phoenix": {:hex, :phoenix, "1.3.4", "aaa1b55e5523083a877bcbe9886d9ee180bf2c8754905323493c2ac325903dc5", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.3.3 or ~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm", "f9eb4926aaad604c5ee4051f462f5981828fb559691236d71f7fb07ac4a0532d"}, + "phoenix_html": {:hex, :phoenix_html, "2.13.3", "850e292ff6e204257f5f9c4c54a8cb1f6fbc16ed53d360c2b780a3d0ba333867", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "8b01b3d6d39731ab18aa548d928b5796166d2500755f553725cfe967bafba7d9"}, + "phoenix_pubsub": {:hex, :phoenix_pubsub, "1.1.1", "6668d787e602981f24f17a5fbb69cc98f8ab085114ebfac6cc36e10a90c8e93c", [:mix], [], "hexpm", "a3d890aaa3156d51056179dcaaadaf32b844f71656bb27c58756f2b97875c36c"}, + "plug": {:hex, :plug, "1.7.2", "d7b7db7fbd755e8283b6c0a50be71ec0a3d67d9213d74422d9372effc8e87fd1", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}], "hexpm", "de9825f21c6fd6adfdeae8f9c80dcd88c1e58301f06bf13d659b7e606b88abe0"}, + "plug_crypto": {:hex, :plug_crypto, "1.0.0", "18e49317d3fa343f24620ed22795ec29d4a5e602d52d1513ccea0b07d8ea7d4d", [:mix], [], "hexpm", "73c1682f0e414cfb5d9b95c8e8cd6ffcfdae699e3b05e1db744e58b7be857759"}, + "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm", "fec8660eb7733ee4117b85f55799fd3833eb769a6df71ccf8903e8dc5447cfce"}, + "scrivener": {:hex, :scrivener, "2.5.0", "e1f78c62b6806d91cc9c4778deef1ea4e80aa9fadfce2c16831afe0468cc8a2c", [:mix], [], "hexpm", "c3e484da6bb7084b5a24c7e38a8ca09310d5fbf5241db05f625fb8af557ef667"}, + "scrivener_ecto": {:hex, :scrivener_ecto, "2.0.0", "e6ee5cc49b44e6115029185f07ffddd7e78475aa40394e98219800fed18f8e42", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:scrivener, "~> 2.4", [hex: :scrivener, repo: "hexpm", optional: false]}], "hexpm", "5b57cbb471968adea1fe77857d71686bbe20d98f72cb6d3eaf01e6b947a4c02f"}, + "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.5", "6eaf7ad16cb568bb01753dbbd7a95ff8b91c7979482b95f38443fe2c8852a79b", [:make, :mix, :rebar3], [], "hexpm", "13104d7897e38ed7f044c4de953a6c28597d1c952075eb2e328bc6d6f2bfc496"}, + "telemetry": {:hex, :telemetry, "0.3.0", "099a7f3ce31e4780f971b4630a3c22ec66d22208bc090fe33a2a3a6a67754a73", [:rebar3], [], "hexpm", "63d9f37d319ff331a51f6221310deb5aac8ea3dcf5e0369d689121b5e52f72d4"}, + "timex": {:hex, :timex, "3.5.0", "b0a23167da02d0fe4f1a4e104d1f929a00d348502b52432c05de875d0b9cffa5", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 0.1.8 or ~> 0.5", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "b8fd8c9fcfaef1fa9c415e0792e2e82783c7ec8a282dfceef7d48158d4cfb3e1"}, + "tzdata": {:hex, :tzdata, "0.5.19", "7962a3997bf06303b7d1772988ede22260f3dae1bf897408ebdac2b4435f4e6a", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "9d73d54f2cd2780da2cb8148c5f9cd35ddc5639467568d2297002ca20ea6bbf7"}, + "unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm", "1d1848c40487cdb0b30e8ed975e34e025860c02e419cb615d255849f3427439d"}, } diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 8b393f27..e1a736fd 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -11,63 +11,76 @@ msgid "" msgstr "" #, elixir-format -#: lib/torch/views/pagination_view.ex:29 +#: lib/torch/messages_backend.ex:17 msgid "< Prev" msgstr "" #, elixir-format -#: lib/torch/views/pagination_view.ex:47 +#: lib/torch/messages_backend.ex:18 msgid "Next >" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:29 -#: lib/torch/views/filter_view.ex:174 +#: lib/torch/messages_backend.ex:6 msgid "Choose one" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:50 -#: lib/torch/views/filter_view.ex:71 +#: lib/torch/messages_backend.ex:5 msgid "Equals" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:49 +#: lib/torch/messages_backend.ex:4 msgid "Contains" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:72 +#: lib/torch/messages_backend.ex:9 msgid "Greater Than" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:73 +#: lib/torch/messages_backend.ex:10 msgid "Greater Than Or Equal" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:74 +#: lib/torch/messages_backend.ex:11 msgid "Less Than" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:139 +#: lib/torch/messages_backend.ex:12 msgid "start" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:146 +#: lib/torch/messages_backend.ex:13 msgid "end" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:185 +#: lib/torch/messages_backend.ex:15 msgid "Select Start Date" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:196 +#: lib/torch/messages_backend.ex:16 msgid "Select End Date" msgstr "" + +#, elixir-format +#: lib/torch/messages_backend.ex:8 +msgid "After" +msgstr "" + +#, elixir-format +#: lib/torch/messages_backend.ex:7 +msgid "Before" +msgstr "" + +#, elixir-format +#: lib/torch/messages_backend.ex:14 +msgid "Select Date" +msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index e94f13c4..1e2b4272 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -1,59 +1,74 @@ #, elixir-format -#: lib/torch/views/pagination_view.ex:29 +#: lib/torch/messages_backend.ex:17 msgid "< Prev" msgstr "" #, elixir-format -#: lib/torch/views/pagination_view.ex:47 +#: lib/torch/messages_backend.ex:18 msgid "Next >" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:29 lib/torch/views/filter_view.ex:174 +#: lib/torch/messages_backend.ex:6 msgid "Choose one" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:50 lib/torch/views/filter_view.ex:71 +#: lib/torch/messages_backend.ex:5 msgid "Equals" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:49 +#: lib/torch/messages_backend.ex:4 msgid "Contains" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:72 +#: lib/torch/messages_backend.ex:9 msgid "Greater Than" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:73 +#: lib/torch/messages_backend.ex:10 msgid "Greater Than Or Equal" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:74 +#: lib/torch/messages_backend.ex:11 msgid "Less Than" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:139 +#: lib/torch/messages_backend.ex:12 msgid "start" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:146 +#: lib/torch/messages_backend.ex:13 msgid "end" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:185 +#: lib/torch/messages_backend.ex:15 msgid "Select Start Date" msgstr "" #, elixir-format -#: lib/torch/views/filter_view.ex:196 +#: lib/torch/messages_backend.ex:16 msgid "Select End Date" msgstr "" + +#, elixir-format +#: lib/torch/messages_backend.ex:8 +msgid "After" +msgstr "" + +#, elixir-format +#: lib/torch/messages_backend.ex:7 +msgid "Before" +msgstr "" + +#, elixir-format, fuzzy +#: lib/torch/messages_backend.ex:14 +msgid "Select Date" +msgstr "" diff --git a/priv/gettext/es/LC_MESSAGES/default.po b/priv/gettext/es/LC_MESSAGES/default.po new file mode 100644 index 00000000..9d22eda9 --- /dev/null +++ b/priv/gettext/es/LC_MESSAGES/default.po @@ -0,0 +1,87 @@ +## "msgid"s in this file come from POT (.pot) files. +## +## Do not add, change, or remove "msgid"s manually here as +## they're tied to the ones in the corresponding POT file +## (with the same domain). +## +## Use "mix gettext.extract --merge" or "mix gettext.merge" +## to merge POT files into PO files. +msgid "" +msgstr "" +"Language: es\n" +"Plural-Forms: nplurals=2\n" + +#, elixir-format +#: lib/torch/messages_backend.ex:17 +msgid "< Prev" +msgstr "< Prev" + +#, elixir-format +#: lib/torch/messages_backend.ex:18 +msgid "Next >" +msgstr "Sig >" + +#, elixir-format +#: lib/torch/messages_backend.ex:6 +msgid "Choose one" +msgstr "Elija uno" + +#, elixir-format +#: lib/torch/messages_backend.ex:5 +msgid "Equals" +msgstr "Igual a" + +#, elixir-format +#: lib/torch/messages_backend.ex:4 +msgid "Contains" +msgstr "Contiene" + +#, elixir-format +#: lib/torch/messages_backend.ex:9 +msgid "Greater Than" +msgstr "Mayor a" + +#, elixir-format +#: lib/torch/messages_backend.ex:10 +msgid "Greater Than Or Equal" +msgstr "Mayor o igual a" + +#, elixir-format +#: lib/torch/messages_backend.ex:11 +msgid "Less Than" +msgstr "Menor a" + +#, elixir-format +#: lib/torch/messages_backend.ex:12 +msgid "start" +msgstr "inicio" + +#, elixir-format +#: lib/torch/messages_backend.ex:13 +msgid "end" +msgstr "fin" + +#, elixir-format +#: lib/torch/messages_backend.ex:15 +msgid "Select Start Date" +msgstr "Seleccione fecha de inicio" + +#, elixir-format +#: lib/torch/messages_backend.ex:16 +msgid "Select End Date" +msgstr "Seleccione fecha de fin" + +#, elixir-format +#: lib/torch/messages_backend.ex:8 +msgid "After" +msgstr "Después de" + +#, elixir-format +#: lib/torch/messages_backend.ex:7 +msgid "Before" +msgstr "Antes de" + +#, elixir-format, fuzzy +#: lib/torch/messages_backend.ex:14 +msgid "Select Date" +msgstr "Seleccione fecha de fin" diff --git a/priv/gettext/ru/LC_MESSAGES/default.po b/priv/gettext/ru/LC_MESSAGES/default.po index 3e42413d..d030915e 100644 --- a/priv/gettext/ru/LC_MESSAGES/default.po +++ b/priv/gettext/ru/LC_MESSAGES/default.po @@ -1,59 +1,74 @@ #, elixir-format -#: lib/torch/views/pagination_view.ex:29 +#: lib/torch/messages_backend.ex:17 msgid "< Prev" msgstr "< Предыдущая" #, elixir-format -#: lib/torch/views/pagination_view.ex:47 +#: lib/torch/messages_backend.ex:18 msgid "Next >" msgstr "Следующая >" #, elixir-format -#: lib/torch/views/filter_view.ex:29 lib/torch/views/filter_view.ex:174 +#: lib/torch/messages_backend.ex:6 msgid "Choose one" msgstr "Выберите один элемент" #, elixir-format -#: lib/torch/views/filter_view.ex:50 lib/torch/views/filter_view.ex:71 +#: lib/torch/messages_backend.ex:5 msgid "Equals" msgstr "Равно" #, elixir-format -#: lib/torch/views/filter_view.ex:49 +#: lib/torch/messages_backend.ex:4 msgid "Contains" msgstr "Содержит" #, elixir-format -#: lib/torch/views/filter_view.ex:72 +#: lib/torch/messages_backend.ex:9 msgid "Greater Than" msgstr "Больше" #, elixir-format -#: lib/torch/views/filter_view.ex:73 +#: lib/torch/messages_backend.ex:10 msgid "Greater Than Or Equal" msgstr "Больше или равно" #, elixir-format -#: lib/torch/views/filter_view.ex:74 +#: lib/torch/messages_backend.ex:11 msgid "Less Than" msgstr "Меньше" #, elixir-format -#: lib/torch/views/filter_view.ex:139 +#: lib/torch/messages_backend.ex:12 msgid "start" msgstr "начало" #, elixir-format -#: lib/torch/views/filter_view.ex:146 +#: lib/torch/messages_backend.ex:13 msgid "end" msgstr "конец" #, elixir-format -#: lib/torch/views/filter_view.ex:185 +#: lib/torch/messages_backend.ex:15 msgid "Select Start Date" msgstr "Выберите дату начала" #, elixir-format -#: lib/torch/views/filter_view.ex:196 +#: lib/torch/messages_backend.ex:16 msgid "Select End Date" msgstr "Выберите дату окончания" + +#, elixir-format +#: lib/torch/messages_backend.ex:8 +msgid "After" +msgstr "" + +#, elixir-format +#: lib/torch/messages_backend.ex:7 +msgid "Before" +msgstr "" + +#, elixir-format, fuzzy +#: lib/torch/messages_backend.ex:14 +msgid "Select Date" +msgstr "Выберите дату окончания" diff --git a/test/torch/i18n_test.exs b/test/torch/i18n_test.exs new file mode 100644 index 00000000..10389121 --- /dev/null +++ b/test/torch/i18n_test.exs @@ -0,0 +1,31 @@ +defmodule Torch.I18nTest do + use ExUnit.Case + + defmodule CustomI18nBackend do + def message("Contains"), do: "** CUSTOMIZED **" + def message(t), do: Torch.I18n.Backend.message(t) + end + + setup_all do + on_exit(fn -> + Application.put_env(:torch, :i18n_backend, CustomI18nBackend) + end) + + [i18n_backend: Torch.Config.i18n_backend()] + end + + test "uses a default backend if none configured", context do + Application.put_env(:torch, :i18n_backend, context[:i18n_backend]) + + assert Torch.I18n.Backend == Torch.Config.i18n_backend() + assert "Contains" == Torch.I18n.message("Contains") + end + + test "allows a custom backend to be defined" do + Application.put_env(:torch, :i18n_backend, CustomI18nBackend) + + assert CustomI18nBackend == Torch.Config.i18n_backend() + assert "** CUSTOMIZED **" == Torch.I18n.message("Contains") + assert "Equals" == Torch.I18n.message("Equals") + end +end diff --git a/test/torch/views/pagination_view_test.exs b/test/torch/views/pagination_view_test.exs index e9b19c01..2afa3368 100644 --- a/test/torch/views/pagination_view_test.exs +++ b/test/torch/views/pagination_view_test.exs @@ -19,10 +19,13 @@ defmodule Torch.PaginationViewTest do end test "internationalization" do - assert %Plug.Conn{params: %{}} |> prev_link(2) |> safe_to_string() =~ "Prev" + assert %Plug.Conn{params: %{}} |> prev_link(2) |> safe_to_string() =~ "< Prev" set_locale("ru") assert %Plug.Conn{params: %{}} |> prev_link(2) |> safe_to_string() =~ "Предыдущая" + + set_locale("es") + assert %Plug.Conn{params: %{}} |> prev_link(2) |> safe_to_string() =~ "< Prev" end end @@ -38,10 +41,13 @@ defmodule Torch.PaginationViewTest do end test "internationalization" do - assert %Plug.Conn{params: %{}} |> next_link(1, 2) |> safe_to_string() =~ "Next" + assert %Plug.Conn{params: %{}} |> next_link(1, 2) |> safe_to_string() =~ "Next >" set_locale("ru") assert %Plug.Conn{params: %{}} |> next_link(1, 2) |> safe_to_string() =~ "Следующая" + + set_locale("es") + assert %Plug.Conn{params: %{}} |> next_link(1, 2) |> safe_to_string() =~ "Sig >" end end