Sha256: 1a5f8922fc54096a7bcb90ebee1bcbc8d3deb9361f46212f4aeab1c83a29a324

Contents?: true

Size: 551 Bytes

Versions: 7

Compression:

Stored size: 551 Bytes

Contents

# Localization

The localization middleware uses the `Accept-Language` header to guess the preferred locale out of the given options. If a request path maps to a resource, that resource is returned. Otherwise, a localized request is made.

```ruby
use Utopia::Localization,
	:default_locale => 'en',
	:locales => ['en', 'de', 'ja', 'zh'],
	:nonlocalized => ['/_static/', '/_cache/']
```

Somewhere further down the chain, you can localize a resource:

```ruby
localization = Utopia::Localization[request]
show_welcome(localization.current_locale)
```

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
utopia-1.9.11 documentation/pages/wiki/middleware/localization/content.md
utopia-2.0.1 documentation/pages/wiki/middleware/localization/content.md
utopia-2.0.0 documentation/pages/wiki/middleware/localization/content.md
utopia-1.9.10 documentation/pages/wiki/middleware/localization/content.md
utopia-1.9.9 documentation/pages/wiki/middleware/localization/content.md
utopia-1.9.7 documentation/pages/wiki/middleware/localization/content.md
utopia-1.9.6 documentation/pages/wiki/middleware/localization/content.md