chore: Clarify guides

This commit is contained in:
Robert Prehn 2021-05-06 12:21:58 -05:00
parent e4324ac3f3
commit 1f8bdba4ca
2 changed files with 17 additions and 2 deletions

View file

@ -8,7 +8,7 @@ allows non-developers on a team to make copy changes.
2. When your application supports multiple languages, it is easy for translators
to provide translations for all of your copy at once.
In Legendary, we provide a set of tools for doing this.
In Legendary, we provide a set of tools for doing this via [linguist](https://github.com/change/linguist).
- (English) strings are stored in config/i18n/en.yml.
- You can call `Legendary.I18n.t!/2` to get a string by its key. For example: `Legendary.I18n.t! "en", "site.title"` retrieves the english version of the
@ -20,5 +20,20 @@ string labeled "title" under the section "site" on en.yml.
Note that the first argument is a two-letter language code. In order to support
other languages, you can provide more yml files in config/i18n (example, config/i18n/fr.yml for French) and call t!/2 with that language code instead.
Linguist also supports templated translations. If you have a section in en.yml like this:
```yaml
app:
hello_message: Hello, %{name}!
```
then you could call `t!` substitutions like this:
```elixir
t! "en", "app.hello_message", name: "Legend"
```
to get the string "Hello, legend!"
**On the roadmap:** in the future, we intend to provide a mechanism for detecting
and managing each visitor's language and providing those strings if available.

View file

@ -27,7 +27,7 @@ Since Legendary is both a template and a framework, you can simply clone the rep
to start using it. It's a fully functional Phoenix app as-is. To start a new project:
```sh
git clone git@gitlab.com:mythic-insight/legendary.git <project_name>
git clone https://gitlab.com/mythic-insight/legendary.git <project_name>
```
In order to start the server, run `script/server`. Any dependencies required