Skip to content

Commit

Permalink
update i18n docs
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianthedev committed Jun 13, 2024
1 parent 89d6480 commit 8afe7c8
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const config = {
{text: "Menu editor", link: "/3.0/menu-editor"},
{text: "Search", link: "/3.0/search"},
{text: "Actions", link: "/3.0/actions"},
{text: "Localization (I18n)", link: "/3.0/localization"},
{text: "Localization (I18n)", link: "/3.0/i18n"},
{text: "Branding", link: "/3.0/branding"},
{text: "Routing", link: "/3.0/routing"},
{text: "Multitenancy", link: "/3.0/multitenancy"},
Expand Down
28 changes: 16 additions & 12 deletions docs/3.0/localization.md → docs/3.0/i18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ license: pro

# Localization (i18n)

Avo leverages Rails' powerful I18n translations module. When you run `bin/rails avo:install`, Rails will generate for you the `avo.en.yml` translation file. This file will automatically be injected into the I18n translations module.
Avo leverages Rails' powerful `I18n` translations module.

# Localizing Avo

When you run `bin/rails avo:install`, Rails will not generate for you the `avo.en.yml` translation file. This file is already loaded will automatically be injected into the I18n translations module.

## Localizing resources

Expand Down Expand Up @@ -79,33 +83,33 @@ en:
## Setting the locale
Setting the locale for Avo is simple. Just use the `config.locale = :en` config attribute. Default is `nil` and will fall back to whatever you have configured in `application.rb`.
Setting the locale for Avo is pretty simple. Just use the `config.locale = :en` config attribute. Default is `nil` and will fall back to whatever you have configured in as `config.i18n.default_locale` in `application.rb`.

```ruby{2}
Avo.configure do |config|
config.locale = :en # default is nil
end
```

That will change the locale only for Avo requests. The rest of your app will still use your locale set in `application.rb`. If you wish to change the locale for the whole app, you can use the `set_locale=pt-BR` param. That will set the default locale until you restart your server.
That will change the locale only for Avo requests. The rest of your app will still use your locale set in `application.rb`. If you wish to change the locale for Avo, you can use the `set_locale=pt-BR` param. That will set the default locale for Avo until you restart your server.

Suppose you wish to change the locale only for one request using the `force_locale=pt-BR` param. That will set the locale for that request and keep the `force_locale` param while you navigate Avo. Remove that param when you want to go back to your configured `default_locale`.
Suppose you wish to change the locale only for one request using the `force_locale=pt-BR` param. That will set the locale for that request and keep the `force_locale` param in all links while you navigate Avo. Remove that param when you want to go back to your configured `default_locale`.

Check out our guide for [multilingual records](guides/multilingual-content).

## Re-generate the locale
Related:
- Check out our guide for [multilingual records](guides/multilingual-content).

When updating Avo, please run `bin/rails generate avo:locales` to re-generate the locales file.
## Customize the locale

## FAQ
If there's anything in the locale files that you would like to change, run `bin/rails generate avo:locales` to generate the locale files.

If you try to localize your resources and fields and it doesn't seem to work, please be aware of the following.
These provide a guide for you for when you want to add more languages.

### Advanced localization is a Pro feature
If you do translate Avo in a new language please consider contributing it to the [main repo](https://github.com/avo-hq/avo). Thank you

Localizing strings in Avo will still work using Rails' `I18n` mechanism, but localizing files and resources require a `Pro` or above license.
## FAQ

The reasoning is that deep localization is a more advanced feature that usually falls in the commercial realm. So if you create commercial products or apps for clients and make revenue using Avo, we'd love to get your support to maintain it and ship new features going forward.
If you try to localize your resources and fields and it doesn't seem to work, please be aware of the following.

### The I18n.t method defaults to the name of that field/resource

Expand Down
2 changes: 1 addition & 1 deletion docs/3.0/licensing.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Avo has two types of licenses. The **Community edition**is free to use and works

The **Community version** has powerful features that you can use today like [Resource management](./resources.html), most [feature-rich](./field-options.html) [fields](./fields.html), out-of-the box [sorting](./field-options.html#sortable-fields), [filtering](./filters.html) and [actions](./actions.html) and all the [associations](./associations.html) you need.

The **Pro version** has [advanced authorization](./authorization.html) using Pundit, [localization support](./localization.html), [Custom tools](./custom-tools.html), [Custom fields](./custom-tools.html) and much [more](https://avohq.io/pricing). [More](https://avohq.io/roadmap) features like Settings screens and Themes are coming soon.
The **Pro version** has [advanced authorization](./authorization.html) using Pundit, [i18n support](./i18n.html), [Custom tools](./custom-tools.html), [Custom fields](./custom-tools.html) and much [more](https://avohq.io/pricing). [More](https://avohq.io/roadmap) features like Settings screens and Themes are coming soon.

The features are separated by their level of complexity and maintenance needs. Selling the Avo Pro edition as a paid upgrade allows us to fund this business and work on it full-time. That way, Avo improves over time, helping developers with more features and customization options.

Expand Down
5 changes: 5 additions & 0 deletions docs/3.0/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ If you're looking for the Avo 2 to Avo 3 upgrade guide, please visit [the dedica

<!-- TODO: add ransack custom repo mention here -->

## Upgrade from 3.9.1 to 3.9.2

We tweaked the way `locales` and i18n work with Avo.
In theory nothing should change in yout setup, but please read [the guide](./i18n) once more to see how it works.

## Upgrade from 3.7.4 to 3.9.1

:::warning Update to Rails 7.2 or greater
Expand Down
6 changes: 6 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
status = 301
force = false

[[redirects]]
from = "/3.0/localization.html"
to = "/3.0/i18n.html"
status = 301
force = false

[[redirects]]
from = "/3.0/recipes/*"
to = "/3.0/guides/:splat"
Expand Down

0 comments on commit 8afe7c8

Please sign in to comment.