Standardise on double quoted strings
This commit is contained in:
parent
5cbd4038ed
commit
dc2a2c8ebd
230 changed files with 1809 additions and 1812 deletions
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require File.dirname(__FILE__) + '/../config/environment'
|
||||
require File.dirname(__FILE__) + "/../config/environment"
|
||||
|
||||
UserToken.delete_all("expiry < NOW()")
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require File.dirname(__FILE__) + '/../config/environment'
|
||||
require File.dirname(__FILE__) + "/../config/environment"
|
||||
|
||||
exit 0 unless recipient = ARGV[0].match(/^([cm])-(\d+)-(.*)$/)
|
||||
|
||||
|
|
|
@ -21,11 +21,11 @@ end
|
|||
def po2hash(f)
|
||||
trs = {}
|
||||
path = []
|
||||
msgstr = ''
|
||||
msgstr = ""
|
||||
f.each_line do |line|
|
||||
line.strip!
|
||||
if line[0..8] == 'msgctxt "'
|
||||
path = line[9..-2].split(':')
|
||||
path = line[9..-2].split(":")
|
||||
elsif line[0..7] == 'msgstr "'
|
||||
msgstr = line[8..-2]
|
||||
end
|
||||
|
@ -34,7 +34,7 @@ def po2hash(f)
|
|||
|
||||
add_translation(trs, path, msgstr)
|
||||
path = []
|
||||
msgstr = ''
|
||||
msgstr = ""
|
||||
end
|
||||
trs
|
||||
end
|
||||
|
@ -42,7 +42,7 @@ end
|
|||
filename = ARGV[0]
|
||||
pofile = File.open(filename, "r")
|
||||
|
||||
langcode = File.basename(filename, '.po')
|
||||
langcode = File.basename(filename, ".po")
|
||||
|
||||
tr = { langcode => po2hash(pofile) }
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require File.dirname(__FILE__) + '/../../config/environment'
|
||||
require File.dirname(__FILE__) + "/../../config/environment"
|
||||
|
||||
Language.load(RAILS_ROOT + "/config/languages.yml")
|
||||
|
|
|
@ -12,15 +12,15 @@
|
|||
require "yaml"
|
||||
require "optparse"
|
||||
|
||||
LOCALE_DIR = File.dirname(__FILE__) + '/../../config/locales/'
|
||||
EN = YAML.load_file(LOCALE_DIR + 'en.yml')
|
||||
LOCALE_DIR = File.dirname(__FILE__) + "/../../config/locales/"
|
||||
EN = YAML.load_file(LOCALE_DIR + "en.yml")
|
||||
|
||||
def iterate(hash, fhash = {}, path = '', outfile = $stdout)
|
||||
def iterate(hash, fhash = {}, path = "", outfile = $stdout)
|
||||
hash.each do |key, val|
|
||||
fhash[key] = {} unless fhash.key? key
|
||||
if val.is_a? Hash
|
||||
fhash[key] = {} unless fhash[key].is_a? Hash
|
||||
iterate(val, fhash[key], path + key + ':', outfile)
|
||||
iterate(val, fhash[key], path + key + ":", outfile)
|
||||
else
|
||||
outfile.puts "msgctxt \"#{path}#{key}\""
|
||||
outfile.puts "msgid \"#{val}\""
|
||||
|
@ -31,34 +31,34 @@ end
|
|||
|
||||
def lang2po(lang, outfile = $stdout)
|
||||
puts lang
|
||||
infile = LOCALE_DIR + lang + '.yml'
|
||||
infile = LOCALE_DIR + lang + ".yml"
|
||||
if File.exist? infile
|
||||
oth = YAML.load_file(infile)
|
||||
oth = oth[lang]
|
||||
iterate(EN['en'], oth, '', outfile)
|
||||
iterate(EN["en"], oth, "", outfile)
|
||||
else
|
||||
iterate(EN['en'], {}, '', outfile)
|
||||
iterate(EN["en"], {}, "", outfile)
|
||||
end
|
||||
end
|
||||
|
||||
opt = ARGV[0]
|
||||
if opt == '--all'
|
||||
if opt == "--all"
|
||||
# Produce .po files for all langs, and a .pot template
|
||||
PO_DIR = LOCALE_DIR + 'po/'
|
||||
PO_DIR = LOCALE_DIR + "po/"
|
||||
Dir.mkdir(PO_DIR) unless File.directory?(PO_DIR)
|
||||
Dir.glob(LOCALE_DIR + "*.yml") do |filename|
|
||||
lang = File.basename(filename, '.yml')
|
||||
unless lang == 'en'
|
||||
outfile = File.new(PO_DIR + "#{lang}.po", 'w')
|
||||
lang = File.basename(filename, ".yml")
|
||||
unless lang == "en"
|
||||
outfile = File.new(PO_DIR + "#{lang}.po", "w")
|
||||
lang2po(lang, outfile)
|
||||
outfile.close
|
||||
end
|
||||
end
|
||||
outfile = File.new(PO_DIR + "rails_port.pot", 'w')
|
||||
iterate(EN['en'], {}, '', outfile)
|
||||
outfile = File.new(PO_DIR + "rails_port.pot", "w")
|
||||
iterate(EN["en"], {}, "", outfile)
|
||||
outfile.close
|
||||
elsif opt
|
||||
lang2po(opt)
|
||||
else
|
||||
iterate(EN['en'])
|
||||
iterate(EN["en"])
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env ruby
|
||||
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
||||
|
||||
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
||||
require File.expand_path('../../config/boot', __FILE__)
|
||||
require 'rails/commands'
|
||||
APP_PATH = File.expand_path("../../config/application", __FILE__)
|
||||
require File.expand_path("../../config/boot", __FILE__)
|
||||
require "rails/commands"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require File.dirname(__FILE__) + '/../config/environment'
|
||||
require File.dirname(__FILE__) + "/../config/environment"
|
||||
|
||||
start_time = Time.now
|
||||
|
||||
|
@ -34,7 +34,7 @@ begin
|
|||
puts "<tr><th>User</th><th>Number of Points</th></tr>"
|
||||
|
||||
Trace.where(:inserted => true).group(:user_id).order("sum_size DESC").limit(50).sum(:size).each do |user, count|
|
||||
display_name = User.find(user).display_name.gsub('@', ' at ').gsub('.', ' dot ')
|
||||
display_name = User.find(user).display_name.gsub("@", " at ").gsub(".", " dot ")
|
||||
puts "<tr><td><a href=\"/user/#{display_name}\">#{display_name}</a></td><td>#{count}</td></tr>"
|
||||
end
|
||||
|
||||
|
@ -72,7 +72,7 @@ begin
|
|||
if column.nil?
|
||||
puts "<td></td>"
|
||||
else
|
||||
display_name = User.find(column[0]).display_name.gsub('@', ' at ').gsub('.', ' dot ')
|
||||
display_name = User.find(column[0]).display_name.gsub("@", " at ").gsub(".", " dot ")
|
||||
count = column[1]
|
||||
puts "<td>#{count} <a href=\"/user/#{display_name}\">#{display_name}</a></td>"
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require File.dirname(__FILE__) + '/../config/environment'
|
||||
require 'generator'
|
||||
require File.dirname(__FILE__) + "/../config/environment"
|
||||
require "generator"
|
||||
|
||||
addresses = User.count(
|
||||
:conditions => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue