mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-10-22 07:21:21 +00:00
build sys: add target for verifying only staged format strings
This commit is contained in:
parent
abbe18f352
commit
e56f474163
32
Rakefile
32
Rakefile
@ -396,13 +396,9 @@ EOT
|
||||
end
|
||||
end
|
||||
|
||||
desc "Verify format strings in translations"
|
||||
task "verify-format-strings" do
|
||||
def verify_format_strings languages
|
||||
is_ok = true
|
||||
|
||||
languages = (ENV['LANGUAGES'] || '').split(/ +/)
|
||||
languages = $available_languages[:applications] if languages.empty?
|
||||
|
||||
languages.
|
||||
collect { |language| "po/#{language}.po" }.
|
||||
sort.
|
||||
@ -411,7 +407,31 @@ EOT
|
||||
is_ok &&= FormatStringVerifier.new.verify file_name
|
||||
end
|
||||
|
||||
exit 1 if !is_ok
|
||||
is_ok
|
||||
end
|
||||
|
||||
desc "Verify format strings in translations"
|
||||
task "verify-format-strings" do
|
||||
languages = (ENV['LANGUAGES'] || '').split(/ +/)
|
||||
languages = $available_languages[:applications] if languages.empty?
|
||||
|
||||
exit 1 if !verify_format_strings(languages)
|
||||
end
|
||||
|
||||
desc "Verify format strings in staged translations"
|
||||
task "verify-format-strings-staged" do
|
||||
languages = `git --no-pager diff --cached --name-only`.
|
||||
split(/\n/).
|
||||
select { |file| /po\/.*\.po$/.match(file) }.
|
||||
map { |file| file.gsub(/.*\//, '').gsub(/\.po/, '') }
|
||||
|
||||
if languages.empty?
|
||||
puts "Error: Nothing staged"
|
||||
exit 2
|
||||
end
|
||||
|
||||
|
||||
exit 1 if !verify_format_strings(languages)
|
||||
end
|
||||
|
||||
[ :applications, :manpages ].each { |type| task type => $translations[type] }
|
||||
|
Loading…
Reference in New Issue
Block a user