Skip to content

Commit

Permalink
Improve docs (#363)
Browse files Browse the repository at this point in the history
* Rename "translation IDs" to "message IDs"

* Move "Default Domain" to a better place

---------

Co-authored-by: c4710n <[email protected]>
  • Loading branch information
c4710n and c4710n authored Jun 1, 2023
1 parent d596823 commit 8cc657d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions lib/gettext.ex
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ defmodule Gettext do
First, call `mix gettext.extract` to extract `gettext()` calls to `.pot`
([Portable Object Template](https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html))
files, which are the base for all translations. These files are *templates*, which
means they only contain translation IDs, and not actual translated strings. POT files have
means they only contain message IDs, and not actual translated strings. POT files have
entries like this:
#: lib/myapp_web/live/hello_live.html.heex:2
Expand Down Expand Up @@ -225,18 +225,6 @@ defmodule Gettext do
config :my_app, MyApp.Gettext, default_locale: "fr"
### Default Domain
Each backend can be configured with a specific `:default_domain`
that replaces `"default"` in `gettext/2`, `pgettext/3`, and `ngettext/4`
for that backend.
defmodule MyApp.Gettext do
use Gettext, otp_app: :my_app, default_domain: "messages"
end
config :my_app, MyApp.Gettext, default_domain: "messages"
## Gettext API
There are two ways to use Gettext:
Expand Down Expand Up @@ -364,6 +352,18 @@ defmodule Gettext do
functions accepting a backend (`gettext/3`, `ngettext/5`, and `pgettext/4`)
_always_ use a domain of "default".
### Default Domain
Each backend can be configured with a specific `:default_domain`
that replaces `"default"` in `gettext/2`, `pgettext/3`, and `ngettext/4`
for that backend.
defmodule MyApp.Gettext do
use Gettext, otp_app: :my_app, default_domain: "messages"
end
config :my_app, MyApp.Gettext, default_domain: "messages"
## Contexts
The GNU Gettext implementation supports
Expand Down

0 comments on commit 8cc657d

Please sign in to comment.