Skip to content

Commit

Permalink
add rake task locale:check
Browse files Browse the repository at this point in the history
  • Loading branch information
minad committed Oct 28, 2012
1 parent 4df379f commit 73e6af7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
21 changes: 20 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,26 @@ end

namespace :locale do
task :sort do
system("for i in $(find -name locale.yml); do sort_yaml < $i > $i.sorted; mv $i.sorted $i; done")
Dir['**/locale.yml'].each do |file|
puts "Sorting #{file}"
system("sort_yaml < #{file} > #{file}.sorted; mv #{file}.sorted #{file}")
end
end

task :check do
require 'yaml'
Dir['**/locale.yml'].each do |file|
puts "Checking #{file}"
translations = YAML.load_file(file)
puts 'en locale missing' unless translations['en']
keys = translations['en'].keys
translations.each do |locale,hash|
delta = hash.keys - keys
puts "\tLocale #{locale} has additional keys #{delta.join(' ')}" unless delta.empty?
delta = keys - hash.keys
puts "\tLocale #{locale} has missing keys #{delta.join(' ')}" unless delta.empty?
end
end
end
end

Expand Down
4 changes: 1 addition & 3 deletions lib/olelo/locale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ cs_CZ:
move_page: 'Přesunout stránku %{page}'
name: 'Jméno'
new_page: 'Nová stránka'
newer: 'Novější'
no_changes: 'Žádné změny'
not_found_text: 'Pardon, stránka, kterou hledáte, nebyla nalezena.'
old_password: 'Staré heslo'
Expand Down Expand Up @@ -244,7 +243,6 @@ en:
move_page: 'Move %{page}'
name: 'Name'
new_page: 'New Page'
newer: 'Newer'
no_changes: 'No changes'
not_found_text: 'Sorry, the page you were looking for was not found.'
not_found_title: '404 Not found'
Expand Down Expand Up @@ -316,13 +314,13 @@ fr:
edit_page_section: "Modifier %{page} (Section)"
email: "Courriel"
empty_password: "Mot de passe vide"
error_binary: "%{page} est un binaire %{type} et ne peut pas être édité comme un fichier texte."
error_occurred: "Oops ! Une erreur est survenue."
file: "Fichier"
groups: "Groupes"
head: "Tête"
history: "Historique"
history_of: "Historique de %{page}"
info_binary: "%{page} est un binaire %{type} et ne peut pas être édité comme un fichier texte."
invalid_email: "Courriel invalide"
invalid_mime_type: "Type MIME invalide"
invalid_name: "Nom invalide"
Expand Down

0 comments on commit 73e6af7

Please sign in to comment.