Add I18n interface for use in Mustache templates (#1679)
* Add `i18n` dependency We will use `i18n` to provide localization for Gollum's frontend. I chose this because it's a well-supported, pretty normal Ruby library. * Configure I18n - Locale files will be kept in `lib/gollum/locales/[lang].yml` - The available locales, to start, will be English (`en`). * Add I18n interface for mustache templates This commit adds an interface that allows mustache templates to get I18n translation strings, transform any arguments that may be present in them, and then render them on the frontend. This is our first real step to getting internationalizing the Gollum frontend.
This commit is contained in:
+5
-2
@@ -5,6 +5,7 @@ require 'digest/sha1'
|
||||
require 'ostruct'
|
||||
|
||||
# external
|
||||
require 'i18n'
|
||||
require 'github/markup'
|
||||
require 'rhino' if RUBY_PLATFORM == 'java'
|
||||
|
||||
@@ -14,10 +15,13 @@ require File.expand_path('../gollum/uri_encode_component', __FILE__)
|
||||
module Gollum
|
||||
VERSION = '5.2.3'
|
||||
|
||||
::I18n.available_locales = [:en]
|
||||
::I18n.load_path = Dir[File.expand_path("lib/gollum/locales") + "/*.yml"]
|
||||
|
||||
def self.assets_path
|
||||
::File.expand_path('gollum/public', ::File.dirname(__FILE__))
|
||||
end
|
||||
|
||||
|
||||
class TemplateFilter
|
||||
@@filters = {}
|
||||
|
||||
@@ -32,5 +36,4 @@ module Gollum
|
||||
data
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user