forked from plume/joinplu.me
Fix i18n
This commit is contained in:
parent
65d74a0a5f
commit
43db60b545
5 changed files with 15 additions and 15 deletions
1
Gemfile
1
Gemfile
|
@ -4,4 +4,3 @@ gem 'middleman', '~> 4.2'
|
|||
gem 'middleman-autoprefixer', '~> 2.7'
|
||||
gem 'tzinfo-data', platforms: [:mswin, :mingw, :jruby]
|
||||
gem 'wdm', '~> 0.1', platforms: [:mswin, :mingw]
|
||||
gem 'gettext', '~> 3.2'
|
||||
|
|
|
@ -5,4 +5,10 @@ like to contribute.
|
|||
|
||||
It is using middleman.
|
||||
|
||||
## Usefull commands
|
||||
|
||||
- `./i18n.sh` to update .pot, .po and .mo files
|
||||
- `middleman` for live preview during development
|
||||
- `middleman build` when deploying
|
||||
|
||||
TODO: automatic deployment https://github.com/hovancik/middleman-github-deploy
|
||||
|
|
23
config.rb
23
config.rb
|
@ -1,25 +1,20 @@
|
|||
require "gettext"
|
||||
require "middleman-core/sitemap/extensions/proxies"
|
||||
require "i18n"
|
||||
|
||||
GetText::bindtextdomain 'joinplume', { path: 'translations' }
|
||||
I18n::Backend::Simple.include(I18n::Backend::Gettext)
|
||||
I18n.load_path << Dir["po/*.po"] # Load all PO file in current directory
|
||||
|
||||
ready do
|
||||
File.readlines('po/LINGUAS').each do |lang|
|
||||
lang = lang.strip
|
||||
GetText::set_locale lang
|
||||
puts(GetText::_("A federated blogging application"))
|
||||
sitemap.resources.select{ |r| !r.respond_to?(:target_resource) && r.ext == ".html" }.each do |res|
|
||||
proxy "#{lang}/#{res.destination_path}", res.path, {}
|
||||
end
|
||||
end
|
||||
end
|
||||
activate :i18n,
|
||||
:langs => [:en, :es, :fr],
|
||||
:path => "/:locale/",
|
||||
:no_fallbacks => true,
|
||||
:data => "po"
|
||||
|
||||
activate :autoprefixer do |prefix|
|
||||
prefix.browsers = "last 2 versions"
|
||||
end
|
||||
|
||||
helpers do
|
||||
include GetText
|
||||
include I18n::Gettext::Helpers
|
||||
end
|
||||
|
||||
# configure :build do
|
||||
|
|
Loading…
Reference in a new issue