Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

I18n extension

  • Loading branch information...
commit daa5ccf8f72ddc4fb9f7019bff5a86a26d7a96a8 1 parent 8e46d4f
@cristi cristi authored
View
4 app/views/admin/_stereotype.html.haml
@@ -1,3 +1,3 @@
%p
- = f.label :stereotype, "Stereotype"
- = f.select :stereotype, [['<none>', '']] + @stereotypes.map { |s| [s, s] }
+ = f.label :stereotype, t('stereotype')
+ = f.select :stereotype, [[t('none'), '']] + @stereotypes.map { |s| [s, s] }
View
2  app/views/admin/_stereotype_th.html.haml
@@ -1 +1 @@
-%th.status Stereotype
+%th.status= t('stereotype')
View
4 config/locales/en.yml
@@ -0,0 +1,4 @@
+---
+en:
+ none: '<none>'
+ stereotype: 'Stereotype'
View
4 config/locales/ro.yml
@@ -0,0 +1,4 @@
+---
+ro:
+ none: '<nici unul>'
+ stereotype: 'Tipar'
View
17 lib/tasks/stereotype_extension_tasks.rake
@@ -11,6 +11,23 @@ namespace :radiant do
task :update => :environment do
puts "This extension has no public assets. Nothing done."
end
+
+ desc "Syncs all available translations for this ext to the English ext master"
+ task :sync => :environment do
+ # The main translation root, basically where English is kept
+ language_root = StereotypeExtension.root + "/config/locales"
+ words = TranslationSupport.get_translation_keys(language_root)
+
+ Dir["#{language_root}/*.yml"].each do |filename|
+ next if filename.match('_available_tags')
+ basename = File.basename(filename, '.yml')
+ puts "Syncing #{basename}"
+ (comments, other) = TranslationSupport.read_file(filename, basename)
+ words.each { |k,v| other[k] ||= words[k] } # Initializing hash variable as empty if it does not exist
+ other.delete_if { |k,v| !words[k] } # Remove if not defined in en.yml
+ TranslationSupport.write_file(filename, basename, comments, other)
+ end
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.