-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvement: gettext_backend convenience wrapper (#563)
Enhances the router macros by a `gettext_backend` option, leading to the creation of the required `gettext_fn` on the fly.
- Loading branch information
1 parent
dbe3926
commit 895a681
Showing
10 changed files
with
126 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
defmodule AshAuthentication.Phoenix.Test.Gettext do | ||
@moduledoc """ | ||
Gettext stub, | ||
referenced in AshAuthentication.Phoenix.Test.Router | ||
""" | ||
use Gettext.Backend, otp_app: :ash_authentication_phoenix | ||
|
||
@spec translate_test(String.t(), keyword) :: String.t() | ||
def translate_test(_msgid, _bindings) do | ||
"Never gonna give you up!" | ||
end | ||
|
||
@impl true | ||
def handle_missing_translation(_locale, _domain, _msgctxt, _msgid, _bindings), | ||
do: {:ok, translate_test("_", [])} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
ExUnit.start() | ||
|
||
AshAuthentication.Phoenix.Test.Endpoint.start_link() | ||
|
||
defmodule AshAuthentication.Phoenix.Test.Helper do | ||
def gettext(_msgid, _bindings) do | ||
"Never gonna give you up!" | ||
end | ||
end |