Updated style and layout
This commit is contained in:
@@ -27,5 +27,6 @@ module BikeBike
|
||||
config.i18n.default_locale = :en
|
||||
config.i18n.enforce_available_locales = false
|
||||
self.paths['config/database'] = Rails.root.parent.join('BikeBike', 'config', 'database.yml')
|
||||
config.active_record.raise_in_transactional_callbacks = true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -52,7 +52,7 @@ BikeBike::Application.configure do
|
||||
#puts "CARMEN\t" + Carmen.i18n_backend.locale_paths
|
||||
|
||||
#PerfTools::CpuProfiler.start('/tmp/dev_prof')
|
||||
config.serve_static_assets = true
|
||||
config.serve_static_files = true
|
||||
#config.assets.precompile = false
|
||||
Paypal.sandbox!
|
||||
#Paypal.sandbox = false
|
||||
|
||||
+236
-236
@@ -1,263 +1,263 @@
|
||||
require 'i18n/backend/active_record'
|
||||
require 'yaml'
|
||||
# require 'i18n/backend/active_record'
|
||||
# require 'yaml'
|
||||
|
||||
if Rails.env.test?
|
||||
class DevTranslation < Translation
|
||||
self.table_name = 'translations'
|
||||
establish_connection :development
|
||||
end
|
||||
end
|
||||
# if Rails.env.test?
|
||||
# class DevTranslation < Translation
|
||||
# self.table_name = 'translations'
|
||||
# establish_connection :development
|
||||
# end
|
||||
# end
|
||||
|
||||
module I18n
|
||||
class MissingTranslationExceptionHandler < ExceptionHandler
|
||||
def self.lorem_ipsum(method, size)
|
||||
options = {:random => true}
|
||||
case method.to_s
|
||||
when 'c', 'char', 'character', 'characters'
|
||||
if size
|
||||
return (Forgery::LoremIpsum.characters size, options).capitalize
|
||||
end
|
||||
return Forgery::LoremIpsum.character, options
|
||||
when 'w', 'word', 'words'
|
||||
if size
|
||||
return (Forgery::LoremIpsum.words size, options).capitalize
|
||||
end
|
||||
#return'LOREM'
|
||||
return (Forgery::LoremIpsum.word options).capitalize
|
||||
when 's', 'sentence', 'sentences'
|
||||
if size
|
||||
return Forgery::LoremIpsum.sentences size, options
|
||||
end
|
||||
return (Forgery::LoremIpsum.sentence options).capitalize
|
||||
when 'p', 'paragraph', 'paragraphs'
|
||||
if size
|
||||
return Forgery::LoremIpsum.paragraphs size, options.merge({:sentences => 10})
|
||||
end
|
||||
return Forgery::LoremIpsum.sentences 10, options
|
||||
when 't', 'title'
|
||||
return (Forgery::LoremIpsum.sentences 1, options).capitalize
|
||||
end
|
||||
return method
|
||||
end
|
||||
# module I18n
|
||||
# class MissingTranslationExceptionHandler < ExceptionHandler
|
||||
# def self.lorem_ipsum(method, size)
|
||||
# options = {:random => true}
|
||||
# case method.to_s
|
||||
# when 'c', 'char', 'character', 'characters'
|
||||
# if size
|
||||
# return (Forgery::LoremIpsum.characters size, options).capitalize
|
||||
# end
|
||||
# return Forgery::LoremIpsum.character, options
|
||||
# when 'w', 'word', 'words'
|
||||
# if size
|
||||
# return (Forgery::LoremIpsum.words size, options).capitalize
|
||||
# end
|
||||
# #return'LOREM'
|
||||
# return (Forgery::LoremIpsum.word options).capitalize
|
||||
# when 's', 'sentence', 'sentences'
|
||||
# if size
|
||||
# return Forgery::LoremIpsum.sentences size, options
|
||||
# end
|
||||
# return (Forgery::LoremIpsum.sentence options).capitalize
|
||||
# when 'p', 'paragraph', 'paragraphs'
|
||||
# if size
|
||||
# return Forgery::LoremIpsum.paragraphs size, options.merge({:sentences => 10})
|
||||
# end
|
||||
# return Forgery::LoremIpsum.sentences 10, options
|
||||
# when 't', 'title'
|
||||
# return (Forgery::LoremIpsum.sentences 1, options).capitalize
|
||||
# end
|
||||
# return method
|
||||
# end
|
||||
|
||||
def self.note(key, behavior = nil, behavior_size = nil)
|
||||
I18n.backend.needs_translation(key)
|
||||
if behavior
|
||||
if behavior.to_s == 'strict'
|
||||
return nil
|
||||
end
|
||||
return self.lorem_ipsum(behavior, behavior_size)
|
||||
end
|
||||
#key.to_s.gsub(/^world\..*\.(.+)\.name$/, '\1').gsub(/^.*\.(.+)?$/, '\1').gsub('_', ' ')
|
||||
key.to_s.gsub(/^world\.(.+)\.name$/, '\1').gsub(/^.*\.(.+)?$/, '\1').gsub('_', ' ')
|
||||
end
|
||||
# def self.note(key, behavior = nil, behavior_size = nil)
|
||||
# I18n.backend.needs_translation(key)
|
||||
# if behavior
|
||||
# if behavior.to_s == 'strict'
|
||||
# return nil
|
||||
# end
|
||||
# return self.lorem_ipsum(behavior, behavior_size)
|
||||
# end
|
||||
# #key.to_s.gsub(/^world\..*\.(.+)\.name$/, '\1').gsub(/^.*\.(.+)?$/, '\1').gsub('_', ' ')
|
||||
# key.to_s.gsub(/^world\.(.+)\.name$/, '\1').gsub(/^.*\.(.+)?$/, '\1').gsub('_', ' ')
|
||||
# end
|
||||
|
||||
def call(exception, locale, key, options)
|
||||
if exception.is_a?(MissingTranslation)
|
||||
I18n::MissingTranslationExceptionHandler.note(key, options[:behavior] || nil, options[:behavior_size] || nil)
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
# def call(exception, locale, key, options)
|
||||
# if exception.is_a?(MissingTranslation)
|
||||
# I18n::MissingTranslationExceptionHandler.note(key, options[:behavior] || nil, options[:behavior_size] || nil)
|
||||
# else
|
||||
# super
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
module Backend
|
||||
class BikeBike < I18n::Backend::ActiveRecord
|
||||
@@needs_translation
|
||||
# module Backend
|
||||
# class BikeBike < I18n::Backend::ActiveRecord
|
||||
# @@needs_translation
|
||||
|
||||
@@translations_file = 'config/locales/translation-info.yml'
|
||||
@@translation_cache_file = 'config/locales/.translation-cache.yml'
|
||||
@@pluralization_rules_file = 'config/locales/pluralization-rules.yml'
|
||||
@@translation_cache
|
||||
@@testing_started = false
|
||||
@@hosts
|
||||
# @@translations_file = 'config/locales/translation-info.yml'
|
||||
# @@translation_cache_file = 'config/locales/.translation-cache.yml'
|
||||
# @@pluralization_rules_file = 'config/locales/pluralization-rules.yml'
|
||||
# @@translation_cache
|
||||
# @@testing_started = false
|
||||
# @@hosts
|
||||
|
||||
def self.init_tests!(new_translations = nil)
|
||||
if Rails.env.test?
|
||||
if !@@testing_started
|
||||
@@testing_started = true
|
||||
File.open(@@translations_file, 'w+')
|
||||
File.open(@@translation_cache_file, 'w+')
|
||||
end
|
||||
if !new_translations.nil?
|
||||
record_translation(new_translations)
|
||||
end
|
||||
end
|
||||
end
|
||||
# def self.init_tests!(new_translations = nil)
|
||||
# if Rails.env.test?
|
||||
# if !@@testing_started
|
||||
# @@testing_started = true
|
||||
# File.open(@@translations_file, 'w+')
|
||||
# File.open(@@translation_cache_file, 'w+')
|
||||
# end
|
||||
# if !new_translations.nil?
|
||||
# record_translation(new_translations)
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
def needs_translation(key)
|
||||
@@needs_translation ||= Array.new
|
||||
@@needs_translation << key
|
||||
end
|
||||
# def needs_translation(key)
|
||||
# @@needs_translation ||= Array.new
|
||||
# @@needs_translation << key
|
||||
# end
|
||||
|
||||
def translate_control(translation)
|
||||
@@translationsOnThisPage = true
|
||||
datakeys = ''
|
||||
translation['vars'].each { |key, value| datakeys += ' data-var-' + key.to_s + '="' + value.to_s.gsub('"', '"') + '"' }
|
||||
('<span class="translate-me ' + (translation['is_translated'] ? '' : 'un') + 'translated lang-' + (translation['lang']) + ' key--' + translation['key'].gsub('.', '--') + '" data-translate-key="' + translation['key'] + '" data-translate-untranslated="' + translation['untranslated'].gsub('"', '"') + (translation['translated'] ? '" data-translate-translated="' + translation['translated'] : '') + '" data-vars="' + (translation['vars'].length ? translation['vars'].to_json.gsub('"', '"') : '') + '" title="' + ('translate.alt_click') + '">' + (translation['html'] || translation['untranslated']) + '</span>').to_s.html_safe
|
||||
end
|
||||
# def translate_control(translation)
|
||||
# @@translationsOnThisPage = true
|
||||
# datakeys = ''
|
||||
# translation['vars'].each { |key, value| datakeys += ' data-var-' + key.to_s + '="' + value.to_s.gsub('"', '"') + '"' }
|
||||
# ('<span class="translate-me ' + (translation['is_translated'] ? '' : 'un') + 'translated lang-' + (translation['lang']) + ' key--' + translation['key'].gsub('.', '--') + '" data-translate-key="' + translation['key'] + '" data-translate-untranslated="' + translation['untranslated'].gsub('"', '"') + (translation['translated'] ? '" data-translate-translated="' + translation['translated'] : '') + '" data-vars="' + (translation['vars'].length ? translation['vars'].to_json.gsub('"', '"') : '') + '" title="' + ('translate.alt_click') + '">' + (translation['html'] || translation['untranslated']) + '</span>').to_s.html_safe
|
||||
# end
|
||||
|
||||
def initialized?
|
||||
begin
|
||||
super
|
||||
rescue
|
||||
return false
|
||||
end
|
||||
end
|
||||
# def initialized?
|
||||
# begin
|
||||
# super
|
||||
# rescue
|
||||
# return false
|
||||
# end
|
||||
# end
|
||||
|
||||
def initialize
|
||||
if !File.exist?(@@translation_cache_file)
|
||||
File.open(@@translation_cache_file, 'w+')
|
||||
end
|
||||
@@translation_cache = YAML.load(File.read(@@translation_cache_file)) || Hash.new
|
||||
super
|
||||
end
|
||||
# def initialize
|
||||
# if !File.exist?(@@translation_cache_file)
|
||||
# File.open(@@translation_cache_file, 'w+')
|
||||
# end
|
||||
# @@translation_cache = YAML.load(File.read(@@translation_cache_file)) || Hash.new
|
||||
# super
|
||||
# end
|
||||
|
||||
def get_translation_info()
|
||||
begin
|
||||
YAML.load_file(@@translations_file) || {}
|
||||
rescue Exception => e
|
||||
# sometimes concurrency issues cause an exception during testing
|
||||
sleep(1/2.0)
|
||||
get_translation_info()
|
||||
end
|
||||
end
|
||||
# def get_translation_info()
|
||||
# begin
|
||||
# YAML.load_file(@@translations_file) || {}
|
||||
# rescue Exception => e
|
||||
# # sometimes concurrency issues cause an exception during testing
|
||||
# sleep(1/2.0)
|
||||
# get_translation_info()
|
||||
# end
|
||||
# end
|
||||
|
||||
def get_pluralization_rules(locale)
|
||||
rules = YAML.load_file(@@pluralization_rules_file)
|
||||
rules[locale.to_sym]
|
||||
end
|
||||
# def get_pluralization_rules(locale)
|
||||
# rules = YAML.load_file(@@pluralization_rules_file)
|
||||
# rules[locale.to_sym]
|
||||
# end
|
||||
|
||||
def get_language_codes()
|
||||
YAML.load_file(@@pluralization_rules_file).keys
|
||||
end
|
||||
# def get_language_codes()
|
||||
# YAML.load_file(@@pluralization_rules_file).keys
|
||||
# end
|
||||
|
||||
def set_locale(host)
|
||||
@@hosts ||= Hash.new
|
||||
default = I18n.default_locale.to_s
|
||||
lang = @@hosts[host]
|
||||
if lang === false
|
||||
lang = nil
|
||||
elsif lang.nil?
|
||||
if (lang = host.gsub(/^(dev|test|www)[\-\.](.*)$/, '\2').gsub(/^(([^\.]+)\.)?[^\.]+\.[^\.]+$/, '\2')).blank? || (host == "localhost")
|
||||
lang = default
|
||||
end
|
||||
if get_language_codes().include? lang
|
||||
if !language_enabled? lang
|
||||
I18n.locale = default
|
||||
return lang
|
||||
end
|
||||
else
|
||||
lang = nil
|
||||
end
|
||||
end
|
||||
I18n.locale = default unless lang.present?
|
||||
# return nil if the language doesn exist, false if it is not enabled, or the code if it is enabled
|
||||
lang.present? ? true : false
|
||||
end
|
||||
# def set_locale(host)
|
||||
# @@hosts ||= Hash.new
|
||||
# default = I18n.default_locale.to_s
|
||||
# lang = @@hosts[host]
|
||||
# if lang === false
|
||||
# lang = nil
|
||||
# elsif lang.nil?
|
||||
# if (lang = host.gsub(/^(dev|test|www)[\-\.](.*)$/, '\2').gsub(/^(([^\.]+)\.)?[^\.]+\.[^\.]+$/, '\2')).blank? || (host == "localhost")
|
||||
# lang = default
|
||||
# end
|
||||
# if get_language_codes().include? lang
|
||||
# if !language_enabled? lang
|
||||
# I18n.locale = default
|
||||
# return lang
|
||||
# end
|
||||
# else
|
||||
# lang = nil
|
||||
# end
|
||||
# end
|
||||
# I18n.locale = default unless lang.present?
|
||||
# # return nil if the language doesn exist, false if it is not enabled, or the code if it is enabled
|
||||
# lang.present? ? true : false
|
||||
# end
|
||||
|
||||
def get_language_completion(lang)
|
||||
total = 0
|
||||
complete = 0
|
||||
get_translation_info().each { |k,v|
|
||||
total += 1
|
||||
complete += v['languages'].include?(lang.to_s) ? 1 : 0
|
||||
}
|
||||
(total ? complete / total.to_f : 0.0) * 100.0
|
||||
end
|
||||
# def get_language_completion(lang)
|
||||
# total = 0
|
||||
# complete = 0
|
||||
# get_translation_info().each { |k,v|
|
||||
# total += 1
|
||||
# complete += v['languages'].include?(lang.to_s) ? 1 : 0
|
||||
# }
|
||||
# (total ? complete / total.to_f : 0.0) * 100.0
|
||||
# end
|
||||
|
||||
def language_enabled?(lang)
|
||||
lang.to_s == I18n.default_locale.to_s || get_language_completion(lang) > 66
|
||||
end
|
||||
# def language_enabled?(lang)
|
||||
# lang.to_s == I18n.default_locale.to_s || get_language_completion(lang) > 66
|
||||
# end
|
||||
|
||||
def request_translation(key, vars, options)
|
||||
locale = options[:locale].to_s
|
||||
options[:locale] = :en
|
||||
translation = I18n.translate(key, vars, options)
|
||||
result = JSON.load(open("http://translate.google.com/translate_a/t?client=t&text=#{URI::escape(translation)}&hl=en&sl=en&tl=#{locale}&ie=UTF-8&oe=UTF-8&multires=1&otf=1&ssel=3&tsel=3&sc=1").read().gsub(/,+/, ',').gsub(/\[,+/, '[').gsub(/,+\]/, ']'))
|
||||
while result.is_a?(Array)
|
||||
result = result[0]
|
||||
end
|
||||
return result
|
||||
end
|
||||
# def request_translation(key, vars, options)
|
||||
# locale = options[:locale].to_s
|
||||
# options[:locale] = :en
|
||||
# translation = I18n.translate(key, vars, options)
|
||||
# result = JSON.load(open("http://translate.google.com/translate_a/t?client=t&text=#{URI::escape(translation)}&hl=en&sl=en&tl=#{locale}&ie=UTF-8&oe=UTF-8&multires=1&otf=1&ssel=3&tsel=3&sc=1").read().gsub(/,+/, ',').gsub(/\[,+/, '[').gsub(/,+\]/, ']'))
|
||||
# while result.is_a?(Array)
|
||||
# result = result[0]
|
||||
# end
|
||||
# return result
|
||||
# end
|
||||
|
||||
def record_translation(key)
|
||||
translations = get_translation_info()
|
||||
translations ||= Hash.new
|
||||
# def record_translation(key)
|
||||
# translations = get_translation_info()
|
||||
# translations ||= Hash.new
|
||||
|
||||
if key.is_a(Array)
|
||||
key.each { |k| translations[k.to_s] ||= Hash.new }
|
||||
else
|
||||
translations[key.to_s] ||= Hash.new
|
||||
end
|
||||
File.open(@@translations_file, 'w') { |f| f.write translations.to_yaml }
|
||||
end
|
||||
# if key.is_a(Array)
|
||||
# key.each { |k| translations[k.to_s] ||= Hash.new }
|
||||
# else
|
||||
# translations[key.to_s] ||= Hash.new
|
||||
# end
|
||||
# File.open(@@translations_file, 'w') { |f| f.write translations.to_yaml }
|
||||
# end
|
||||
|
||||
protected
|
||||
def lookup(locale, key, scope = [], options = {})
|
||||
result = nil
|
||||
# protected
|
||||
# def lookup(locale, key, scope = [], options = {})
|
||||
# result = nil
|
||||
|
||||
if key.is_a?(String)
|
||||
key = key.gsub(/(^\[|\])/, '').gsub(/\[/, '.')
|
||||
end
|
||||
# if key.is_a?(String)
|
||||
# key = key.gsub(/(^\[|\])/, '').gsub(/\[/, '.')
|
||||
# end
|
||||
|
||||
if @@translation_cache && @@translation_cache.has_key?(locale.to_s) && @@translation_cache[locale.to_s].has_key?(key.to_s)
|
||||
result = @@translation_cache[locale.to_s][key.to_s]
|
||||
end
|
||||
if !result
|
||||
result = super(locale, key, scope, options)
|
||||
# if @@translation_cache && @@translation_cache.has_key?(locale.to_s) && @@translation_cache[locale.to_s].has_key?(key.to_s)
|
||||
# result = @@translation_cache[locale.to_s][key.to_s]
|
||||
# end
|
||||
# if !result
|
||||
# result = super(locale, key, scope, options)
|
||||
|
||||
if Rails.env.test? && options[:behavior].to_s != 'scrict'
|
||||
if result
|
||||
@@translation_cache[locale.to_s] ||= Hash.new
|
||||
@@translation_cache[locale.to_s][key.to_s] = result
|
||||
File.open(@@translation_cache_file, 'w') { |f| f.write @@translation_cache.to_yaml }
|
||||
end
|
||||
# if Rails.env.test? && options[:behavior].to_s != 'scrict'
|
||||
# if result
|
||||
# @@translation_cache[locale.to_s] ||= Hash.new
|
||||
# @@translation_cache[locale.to_s][key.to_s] = result
|
||||
# File.open(@@translation_cache_file, 'w') { |f| f.write @@translation_cache.to_yaml }
|
||||
# end
|
||||
|
||||
translations = get_translation_info()
|
||||
translations ||= Hash.new
|
||||
translations[key.to_s] ||= Hash.new
|
||||
translations[key.to_s]['languages'] ||= Array.new
|
||||
translations[key.to_s]['pages'] ||= Array.new
|
||||
if options['behavior']
|
||||
translations[key.to_s]['behavior'] ||= options['behavior']
|
||||
end
|
||||
vars = []
|
||||
options.each { |o,v|
|
||||
if !I18n::RESERVED_KEYS.include?(o.to_sym) && o.to_s != 'behavior' && o.to_s != 'behavior_size'
|
||||
vars << o.to_sym
|
||||
end
|
||||
}
|
||||
if vars.size() > 0
|
||||
translations[key.to_s]['vars'] = vars
|
||||
end
|
||||
unless translations[key.to_s].has_key?('data')
|
||||
translations[key.to_s]['data'] = Array.new
|
||||
DevTranslation.where("key = '#{key.to_s}' OR key LIKE '#{key.to_s}#{I18n::Backend::Flatten::FLATTEN_SEPARATOR}%'").each { |t|
|
||||
translations[key.to_s]['data'] << ActiveSupport::JSON.encode(t.becomes(Translation))
|
||||
unless translations[key.to_s]['languages'].include?(t.locale.to_s)
|
||||
translations[key.to_s]['languages'] << t.locale.to_s
|
||||
end
|
||||
}
|
||||
end
|
||||
path = $page_info[:path]
|
||||
route = nil
|
||||
Rails.application.routes.routes.each { |r|
|
||||
if !route && r.path.match(path)
|
||||
route = r.path.spec.to_s.gsub(/\s*\(\.:\w+\)\s*$/, '')
|
||||
end
|
||||
}
|
||||
unless translations[key.to_s]['pages'].include?(route)
|
||||
translations[key.to_s]['pages'] << route
|
||||
end
|
||||
File.open(@@translations_file, 'w') { |f| f.write translations.to_yaml }
|
||||
end
|
||||
end
|
||||
# translations = get_translation_info()
|
||||
# translations ||= Hash.new
|
||||
# translations[key.to_s] ||= Hash.new
|
||||
# translations[key.to_s]['languages'] ||= Array.new
|
||||
# translations[key.to_s]['pages'] ||= Array.new
|
||||
# if options['behavior']
|
||||
# translations[key.to_s]['behavior'] ||= options['behavior']
|
||||
# end
|
||||
# vars = []
|
||||
# options.each { |o,v|
|
||||
# if !I18n::RESERVED_KEYS.include?(o.to_sym) && o.to_s != 'behavior' && o.to_s != 'behavior_size'
|
||||
# vars << o.to_sym
|
||||
# end
|
||||
# }
|
||||
# if vars.size() > 0
|
||||
# translations[key.to_s]['vars'] = vars
|
||||
# end
|
||||
# unless translations[key.to_s].has_key?('data')
|
||||
# translations[key.to_s]['data'] = Array.new
|
||||
# DevTranslation.where("key = '#{key.to_s}' OR key LIKE '#{key.to_s}#{I18n::Backend::Flatten::FLATTEN_SEPARATOR}%'").each { |t|
|
||||
# translations[key.to_s]['data'] << ActiveSupport::JSON.encode(t.becomes(Translation))
|
||||
# unless translations[key.to_s]['languages'].include?(t.locale.to_s)
|
||||
# translations[key.to_s]['languages'] << t.locale.to_s
|
||||
# end
|
||||
# }
|
||||
# end
|
||||
# path = $page_info[:path]
|
||||
# route = nil
|
||||
# Rails.application.routes.routes.each { |r|
|
||||
# if !route && r.path.match(path)
|
||||
# route = r.path.spec.to_s.gsub(/\s*\(\.:\w+\)\s*$/, '')
|
||||
# end
|
||||
# }
|
||||
# unless translations[key.to_s]['pages'].include?(route)
|
||||
# translations[key.to_s]['pages'] << route
|
||||
# end
|
||||
# File.open(@@translations_file, 'w') { |f| f.write translations.to_yaml }
|
||||
# end
|
||||
# end
|
||||
|
||||
result
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
# result
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
I18n.exception_handler = I18n::MissingTranslationExceptionHandler.new
|
||||
# I18n.exception_handler = I18n::MissingTranslationExceptionHandler.new
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
require 'i18n/backend/active_record'
|
||||
I18n.backend = I18n::Backend::BikeBike.new
|
||||
#require 'i18n/backend/active_record'
|
||||
I18n.backend = I18n::Backend::LinguaFranca.new
|
||||
# I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Memoize)
|
||||
# I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Flatten)
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
# Sample localization file for English. Add more files in this directory for other locales.
|
||||
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
||||
|
||||
en:
|
||||
helpers:
|
||||
actions: "Actions"
|
||||
links:
|
||||
back: "Back"
|
||||
cancel: "Cancel"
|
||||
confirm: "Are you sure?"
|
||||
destroy: "Delete"
|
||||
new: "New"
|
||||
edit: "Edit"
|
||||
titles:
|
||||
edit: "Edit"
|
||||
save: "Save"
|
||||
new: "New"
|
||||
delete: "Delete"
|
||||
@@ -1,5 +1,11 @@
|
||||
---
|
||||
en:
|
||||
home:
|
||||
what_is_bikebike: What is Bike!Bike!?
|
||||
its_awesome: It's awesome, that's what it is.
|
||||
date:
|
||||
date_span: '%{date_1} – %{date_2}'
|
||||
formats:
|
||||
span_same_month_date_1: '%B %e'
|
||||
span_same_month_date_2: '%e, %Y'
|
||||
span_same_year_date_1: '%B %e'
|
||||
span_same_year_date_2: '%B %e, %Y'
|
||||
span_different_year_date_1: '%B %e, %Y'
|
||||
span_different_year_date_2: '%B %e, %Y'
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
es:
|
||||
home:
|
||||
what_is_bikebike: ¿Qué es la Bike!Bike!?
|
||||
@@ -1,54 +0,0 @@
|
||||
Bike!Bike! translation and English copyright is being designed to operate on a volunteer basis.
|
||||
|
||||
Do not use any static text that will be seen by the public on the site. Instead use the single underscore
|
||||
helper method. For example, on a page that includes a page header such as 'Organizations', simply enter:
|
||||
|
||||
%h1
|
||||
<%= _ organizations.title ?>
|
||||
|
||||
Upon first viewing the page, the user (probably you) will see the resulting HTML:
|
||||
|
||||
<h1><a class="translate-me" ... >organizations.title</a></h1>
|
||||
|
||||
Assuming that you're viewing the sire in English, clicking the link will then allow you to enter English
|
||||
copy. Enter 'Organizations' and save it. The next time you see the page, you will see:
|
||||
|
||||
<h1>Organizations</h1>
|
||||
|
||||
Once a spanish viewer sees the page they will see:
|
||||
|
||||
<h1><a class="translate-me lang-eng" ... >Organizations</a></h1>
|
||||
|
||||
This will allow them to choose an appropriate translation. They may then enter 'Organizaciones'
|
||||
which will result in subsequent Spanish viewers to see the translation.
|
||||
|
||||
When the text to be shown cannot be surrounded by HTML tags, for example for an <input> control,
|
||||
the translation controls can be queued to be shown comtime afterwards using the double underscore
|
||||
method, followed by the single underscore method. For example:
|
||||
|
||||
%input{:name => "organization-name", :placeholder => <%= __ organizations.enter_name %>}
|
||||
<%= _ %>
|
||||
|
||||
Assuming that 'en.organizations.enter_name' = 'Enter the name of your organization', this willl
|
||||
result in the following HTML:
|
||||
|
||||
<input name="organization-name" placeholder="Enter the name of your organization" />
|
||||
|
||||
However, for a Spanish viewer, before a translation has been selected they should see:
|
||||
|
||||
<input name="organization-name" placeholder="Enter the name of your organization" />
|
||||
<div class="untranslated-list">
|
||||
<a class="translate-me lang-eng">Enter the name of your organization</a>
|
||||
</div>
|
||||
|
||||
If multiple items are queued, they will all be shown inside this div. After a translation has been entered
|
||||
by a Spanish speaking volunteer, subsequent volunteers will simply see:
|
||||
|
||||
<input name="organization-name" placeholder="Escriba el nombre de su organización" />
|
||||
|
||||
Best practices:
|
||||
- Never edit en.yml, or any other files directly, always use the site tool to do this as it will
|
||||
help ensure proper testing of all pages and that all text will be translated.
|
||||
- Reuse locale keys as much as possible. Use concatenation of printf where it makes sense to do
|
||||
so. The less work volunteers have to do, the more likely that they will get it all done.
|
||||
|
||||
@@ -1,336 +0,0 @@
|
||||
af:
|
||||
- one
|
||||
- other
|
||||
am:
|
||||
- one
|
||||
- other
|
||||
ar:
|
||||
- zero
|
||||
- one
|
||||
- two
|
||||
- few
|
||||
- many
|
||||
- other
|
||||
az:
|
||||
- other
|
||||
be:
|
||||
- one
|
||||
- few
|
||||
- many
|
||||
- other
|
||||
bg:
|
||||
- one
|
||||
- other
|
||||
bh:
|
||||
- one
|
||||
- other
|
||||
bn:
|
||||
- one
|
||||
- other
|
||||
bo:
|
||||
- other
|
||||
bs:
|
||||
- one
|
||||
- few
|
||||
- many
|
||||
- other
|
||||
ca:
|
||||
- one
|
||||
- other
|
||||
cs:
|
||||
- one
|
||||
- few
|
||||
- other
|
||||
cy:
|
||||
- one
|
||||
- two
|
||||
- many
|
||||
- other
|
||||
da:
|
||||
- one
|
||||
- other
|
||||
de:
|
||||
- one
|
||||
- other
|
||||
dz:
|
||||
- other
|
||||
el:
|
||||
- one
|
||||
- other
|
||||
en:
|
||||
- one
|
||||
- other
|
||||
eo:
|
||||
- one
|
||||
- other
|
||||
es:
|
||||
- one
|
||||
- other
|
||||
et:
|
||||
- one
|
||||
- other
|
||||
eu:
|
||||
- one
|
||||
- other
|
||||
fa:
|
||||
- other
|
||||
fi:
|
||||
- one
|
||||
- other
|
||||
fi:
|
||||
- one
|
||||
- other
|
||||
fo:
|
||||
- one
|
||||
- other
|
||||
fr:
|
||||
- one
|
||||
- other
|
||||
fu:
|
||||
- one
|
||||
- other
|
||||
fy:
|
||||
- one
|
||||
- other
|
||||
ga:
|
||||
- one
|
||||
- two
|
||||
- other
|
||||
gl:
|
||||
- one
|
||||
- other
|
||||
gu:
|
||||
- one
|
||||
- other
|
||||
gu:
|
||||
- one
|
||||
- other
|
||||
ha:
|
||||
- one
|
||||
- other
|
||||
he:
|
||||
- one
|
||||
- other
|
||||
hi:
|
||||
- one
|
||||
- other
|
||||
hr:
|
||||
- one
|
||||
- few
|
||||
- many
|
||||
- other
|
||||
hu:
|
||||
- other
|
||||
id:
|
||||
- other
|
||||
is:
|
||||
- one
|
||||
- other
|
||||
it:
|
||||
- one
|
||||
- other
|
||||
ja:
|
||||
- other
|
||||
jv:
|
||||
- other
|
||||
ka:
|
||||
- other
|
||||
km:
|
||||
- other
|
||||
kn:
|
||||
- other
|
||||
ko:
|
||||
- other
|
||||
ku:
|
||||
- one
|
||||
- other
|
||||
lb:
|
||||
- one
|
||||
- other
|
||||
ln:
|
||||
- one
|
||||
- other
|
||||
lt:
|
||||
- one
|
||||
- few
|
||||
- other
|
||||
lv:
|
||||
- zero
|
||||
- one
|
||||
- other
|
||||
mg:
|
||||
- one
|
||||
- other
|
||||
mk:
|
||||
- one
|
||||
- other
|
||||
ml:
|
||||
- one
|
||||
- other
|
||||
mn:
|
||||
- one
|
||||
- other
|
||||
mo:
|
||||
- one
|
||||
- few
|
||||
- other
|
||||
mr:
|
||||
- one
|
||||
- other
|
||||
ms:
|
||||
- other
|
||||
mt:
|
||||
- one
|
||||
- few
|
||||
- many
|
||||
- other
|
||||
my:
|
||||
- other
|
||||
na:
|
||||
- one
|
||||
- other
|
||||
nb:
|
||||
- one
|
||||
- other
|
||||
ne:
|
||||
- one
|
||||
- other
|
||||
nl:
|
||||
- one
|
||||
- other
|
||||
nn:
|
||||
- one
|
||||
- other
|
||||
no:
|
||||
- one
|
||||
- other
|
||||
ns:
|
||||
- one
|
||||
- other
|
||||
om:
|
||||
- one
|
||||
- other
|
||||
or:
|
||||
- one
|
||||
- other
|
||||
pa:
|
||||
- one
|
||||
- other
|
||||
pa:
|
||||
- one
|
||||
- other
|
||||
pl:
|
||||
- one
|
||||
- few
|
||||
- other
|
||||
ps:
|
||||
- one
|
||||
- other
|
||||
pt:
|
||||
- one
|
||||
- other
|
||||
ro:
|
||||
- one
|
||||
- few
|
||||
- other
|
||||
ru:
|
||||
- one
|
||||
- few
|
||||
- many
|
||||
- other
|
||||
se:
|
||||
- one
|
||||
- two
|
||||
- other
|
||||
sh:
|
||||
- one
|
||||
- few
|
||||
- many
|
||||
- other
|
||||
sk:
|
||||
- one
|
||||
- few
|
||||
- other
|
||||
sl:
|
||||
- one
|
||||
- two
|
||||
- few
|
||||
- other
|
||||
sm:
|
||||
- one
|
||||
- two
|
||||
- other
|
||||
sm:
|
||||
- one
|
||||
- two
|
||||
- other
|
||||
sm:
|
||||
- one
|
||||
- two
|
||||
- other
|
||||
sm:
|
||||
- one
|
||||
- two
|
||||
- other
|
||||
sm:
|
||||
- one
|
||||
- two
|
||||
- other
|
||||
so:
|
||||
- one
|
||||
- other
|
||||
sq:
|
||||
- one
|
||||
- other
|
||||
sr:
|
||||
- one
|
||||
- few
|
||||
- many
|
||||
- other
|
||||
sv:
|
||||
- one
|
||||
- other
|
||||
sw:
|
||||
- one
|
||||
- other
|
||||
ta:
|
||||
- one
|
||||
- other
|
||||
te:
|
||||
- one
|
||||
- other
|
||||
th:
|
||||
- other
|
||||
ti:
|
||||
- one
|
||||
- other
|
||||
tk:
|
||||
- one
|
||||
- other
|
||||
tl:
|
||||
- one
|
||||
- other
|
||||
to:
|
||||
- other
|
||||
tr:
|
||||
- other
|
||||
uk:
|
||||
- one
|
||||
- few
|
||||
- many
|
||||
- other
|
||||
ur:
|
||||
- one
|
||||
- other
|
||||
vi:
|
||||
- other
|
||||
wa:
|
||||
- one
|
||||
- other
|
||||
yo:
|
||||
- other
|
||||
zh:
|
||||
- other
|
||||
zu:
|
||||
- one
|
||||
- other
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,78 +0,0 @@
|
||||
---
|
||||
nola_2013.about:
|
||||
langauges: {}
|
||||
pages:
|
||||
- "/"
|
||||
home.its_awesome:
|
||||
langauges: {}
|
||||
pages:
|
||||
- "/"
|
||||
Conferences:
|
||||
langauges: {}
|
||||
pages:
|
||||
- "/"
|
||||
- "/login"
|
||||
Organizations:
|
||||
langauges: {}
|
||||
pages:
|
||||
- "/"
|
||||
- "/login"
|
||||
Resources:
|
||||
langauges: {}
|
||||
pages:
|
||||
- "/"
|
||||
- "/login"
|
||||
Sign_In:
|
||||
langauges: {}
|
||||
pages:
|
||||
- "/"
|
||||
- "/login"
|
||||
missing.translation:
|
||||
langauges: {}
|
||||
pages:
|
||||
- "/"
|
||||
- "/login"
|
||||
form.Enter_your_email:
|
||||
langauges: {}
|
||||
pages:
|
||||
- "/login"
|
||||
email:
|
||||
langauges: {}
|
||||
pages:
|
||||
- "/login"
|
||||
password:
|
||||
langauges: {}
|
||||
pages:
|
||||
- "/login"
|
||||
sign_in:
|
||||
langauges: {}
|
||||
pages:
|
||||
- "/login"
|
||||
facebook_sign_in:
|
||||
langauges: {}
|
||||
pages:
|
||||
- "/login"
|
||||
user.Create_Account:
|
||||
langauges: {}
|
||||
pages:
|
||||
- "/login"
|
||||
user.why_register:
|
||||
langauges: {}
|
||||
pages:
|
||||
- "/login"
|
||||
form.Enter_your_username:
|
||||
langauges: {}
|
||||
pages:
|
||||
- "/login"
|
||||
username:
|
||||
langauges: {}
|
||||
pages:
|
||||
- "/login"
|
||||
password_confirmation:
|
||||
langauges: {}
|
||||
pages:
|
||||
- "/login"
|
||||
register:
|
||||
langauges: {}
|
||||
pages:
|
||||
- "/login"
|
||||
Reference in New Issue
Block a user