Add plugins/poll and discourse_imgur translation files to transifex

This commit is contained in:
Neil Lalonde 2014-04-24 10:11:23 -04:00
parent c52ee665b4
commit 69dee799e9
12 changed files with 83 additions and 37 deletions

View File

@ -21,6 +21,36 @@ trans.ko_KR = config/locales/server.ko.yml
trans.pt_PT = config/locales/server.pt.yml
type = YML
[discourse-org.pollclientenyml]
file_filter = plugins/poll/config/locales/client.<lang>.yml
source_file = plugins/poll/config/locales/client.en.yml
source_lang = en
trans.es_ES = plugins/poll/config/locales/client.es.yml
trans.fr_FR = plugins/poll/config/locales/client.fr.yml
#trans.ko_KR = plugins/poll/config/locales/client.ko.yml
#trans.pt_PT = plugins/poll/config/locales/client.pt.yml
type = YML
[discourse-org.pollserverenyml]
file_filter = plugins/poll/config/locales/server.<lang>.yml
source_file = plugins/poll/config/locales/server.en.yml
source_lang = en
trans.es_ES = plugins/poll/config/locales/server.es.yml
trans.fr_FR = plugins/poll/config/locales/server.fr.yml
#trans.ko_KR = plugins/poll/config/locales/server.ko.yml
#trans.pt_PT = plugins/poll/config/locales/server.pt.yml
type = YML
[discourse-org.imgurserverenyml]
file_filter = vendor/gems/discourse_imgur/lib/discourse_imgur/locale/server.<lang>.yml
source_file = vendor/gems/discourse_imgur/lib/discourse_imgur/locale/server.en.yml
source_lang = en
trans.es_ES = vendor/gems/discourse_imgur/lib/discourse_imgur/locale/server.es.yml
trans.fr_FR = vendor/gems/discourse_imgur/lib/discourse_imgur/locale/server.fr.yml
#trans.ko_KR = vendor/gems/discourse_imgur/lib/discourse_imgur/locale/server.ko.yml
trans.pt_PT = vendor/gems/discourse_imgur/lib/discourse_imgur/locale/server.pt.yml
type = YML
[discourse-org.403html]
file_filter = public/403.<lang>.html
source_file = public/403.html

View File

@ -33,7 +33,7 @@ unless $?.success?
exit $?.exitstatus
end
yml_file_comments = <<END
YML_FILE_COMMENTS = <<END
# encoding: utf-8
#
# Never edit this file. It will be overwritten when translations are pulled from Transifex.
@ -42,40 +42,56 @@ yml_file_comments = <<END
# https://www.transifex.com/projects/p/discourse-pt-br/
END
ALL_LOCALES = Dir.glob( File.expand_path("../../config/locales/client.*.yml", __FILE__) ).map {|x| x.split('.')[-2]}.sort
LOCALE_MAPPINGS = [['fr', 'fr_FR'],
['es', 'es_ES'],
['pt', 'pt_PT'],
['ko', 'ko_KR']]
YML_DIRS = ['config/locales',
'plugins/poll/config/locales',
'vendor/gems/discourse_imgur/lib/discourse_imgur/locale']
# Change root element in yml files for some languages because Transifex uses a different
# locale code.
[['fr', 'fr_FR'], ['es', 'es_ES'], ['pt', 'pt_PT'], ['ko', 'ko_KR']].each do |ours, theirs|
LOCALE_MAPPINGS.each do |ours, theirs|
['client', 'server'].each do |base|
contents = []
file_name = File.expand_path("../../config/locales/#{base}.#{ours}.yml", __FILE__)
found = false
next unless File.exists?(file_name)
File.open(file_name, 'r') do |file|
file.each_line do |line|
if found or line.strip != "#{theirs}:"
contents << line
else
contents << "#{ours}:"
found = true
YML_DIRS.each do |dir|
contents = []
file_name = File.expand_path("../../#{dir}/#{base}.#{ours}.yml", __FILE__)
found = false
next unless File.exists?(file_name)
File.open(file_name, 'r') do |file|
file.each_line do |line|
if found or line.strip != "#{theirs}:"
contents << line
else
contents << "#{ours}:"
found = true
end
end
end
end
File.open(file_name, 'w+') do |f|
f.puts(yml_file_comments, '') unless contents[0][0] == '#'
f.puts contents
File.open(file_name, 'w+') do |f|
f.puts(YML_FILE_COMMENTS, '') unless contents[0][0] == '#'
f.puts contents
end
end
end
end
(Dir.glob( File.expand_path("../../config/locales/client.*.yml", __FILE__) ).map {|x| x.split('.')[-2]}.sort - ['fr', 'es', 'pt', 'ko']).each do |locale|
# Add comments to the top of files
(ALL_LOCALES - LOCALE_MAPPINGS.map(&:first)).each do |locale|
['client', 'server'].each do |base|
file_name = File.expand_path("../../config/locales/#{base}.#{locale}.yml", __FILE__)
next unless File.exists?(file_name)
contents = File.readlines(file_name)
File.open(file_name, 'w+') do |f|
f.puts(yml_file_comments, '') unless contents[0][0] == '#'
f.puts contents
YML_DIRS.each do |dir|
file_name = File.expand_path("../../#{dir}/#{base}.#{locale}.yml", __FILE__)
next unless File.exists?(file_name)
contents = File.readlines(file_name)
File.open(file_name, 'w+') do |f|
f.puts(YML_FILE_COMMENTS, '') unless contents[0][0] == '#'
f.puts contents
end
end
end
end

View File

@ -1,5 +1,5 @@
de:
site_settings:
site_settings:
enable_imgur: "Aktiviere die Imgur API zum Hochladen, so dass Dateien nicht lokal gehostet werden."
imgur_client_id: "Deine imgur.com Client-ID. Wird benötigt, um Bilder hochzuladen."
imgur_client_secret: "Dein imgur.com Geheimniss. Wird zur Zeit für das Hochladen der Bilder nicht benötigt, könnte aber in Zukunft benötigt werden."

View File

@ -1,5 +1,5 @@
en:
site_settings:
enable_imgur: "Enable imgur api for uploading, don't host files locally"
imgur_client_id: "Your imgur.com client ID, required for image upload to function"
imgur_client_secret: "Your imgur.com client secret. Not currently required for image upload to function, but may be at some point."
site_settings:
enable_imgur: "Enable imgur api for uploading, don't host files locally"
imgur_client_id: "Your imgur.com client ID, required for image upload to function"
imgur_client_secret: "Your imgur.com client secret. Not currently required for image upload to function, but may be at some point."

View File

@ -1,5 +1,5 @@
es:
site_settings:
site_settings:
enable_imgur: "Activar imgur api para subidas, no almacenes ficheros localmente"
imgur_api_key: "Tu imgur.com api key, requerida para la función de subida de imágenes"
imgur_endpoint: "End point para la subida de imagenes de imgur.com"

View File

@ -1,5 +1,5 @@
fr:
site_settings:
site_settings:
enable_imgur: "utiliser l'envoi des images avec l'API imgur, ne pas stocker les fichiers localement"
imgur_client_id: "Votre ID client imgur.com. Requis pour que l'envoi d'images fonctionne."
imgur_client_secret: "Votre secret imgur.com. Pas nécessaire pour que l'envoi d'image fonctionne, mais pourrais le devenir."

View File

@ -1,5 +1,5 @@
it:
site_settings:
site_settings:
enable_imgur: "Utilizza le api imgur per l'upload, non salvare file in locale"
imgur_client_id: "Your imgur.com client ID, required for image upload to function"
imgur_client_secret: "Your imgur.com client secret. Not currently required for image upload to function, but may be at some point."

View File

@ -1,5 +1,5 @@
nl:
site_settings:
site_settings:
enable_imgur: "Gebruik de imgur API voor uploads en sla afbeeldingen niet lokaal op"
imgur_client_id: "Je imgur.com client ID, nodig om afbeeldingen te kunnen uploaden naar imgur"
imgur_client_secret: "Je imgur.com client secret. Is nog niet nodig voor het uploaden van afbeeldingen, maar dat zou in de toekomst kunnen veranderen."

View File

@ -1,5 +1,5 @@
pt:
site_settings:
site_settings:
enable_imgur: "permitir imgur api para uploading, não guardar ficheiros localmente"
imgur_api_key: "chave para imgur.com api - necessária para image upload"
imgur_endpoint: "end point para uploading imgur.com images"

View File

@ -1,5 +1,5 @@
sv:
site_settings:
site_settings:
enable_imgur: "Aktivera imgur.coms API för uppladdning, sparar inte filer lokalt"
imgur_api_key: "Din API-nyckel för imgur.com, krävs för att bilduppladdningen ska funka"
imgur_endpoint: "Ändpunkt för uppladdning av bilder till imgur.com"

View File

@ -1,5 +1,5 @@
zs_CN:
site_settings:
site_settings:
enable_imgur: "启用 Imgur API 来上传文件,不在本地(站点服务器)保存文件"
imgur_client_id: "你的imgur.com的客户端ID以便图片上传能正常工作。"
imgur_client_secret: "你的imgur.com的客户端secret。 目前图片上传功能并不需要这项信息,但是将来的某天可能需要。"

View File

@ -1,5 +1,5 @@
zh_TW:
site_settings:
site_settings:
enable_imgur: "啓用 Imgur API 來上傳文件,不在本地(站點服務器)保存文件"
imgur_client_id: "你的imgur.com的客戶端ID以便圖片上傳能正常工作。"
imgur_client_secret: "你的imgur.com的客戶端secret。 目前圖片上傳功能並不需要這項信息,但是將來的某天可能需要。"