lib/bisu/source/google_sheet.rb in bisu-1.10.1 vs lib/bisu/source/google_sheet.rb in bisu-1.10.2
- old
+ new
@@ -2,12 +2,13 @@
require "csv"
module Bisu
module Source
class GoogleSheet
- def initialize(url)
+ def initialize(url, keys_column)
@url = url
+ @keys_column = keys_column
end
def to_i18
Logger.info("Downloading Google Sheet from #{@url}...")
@@ -18,10 +19,10 @@
languages = csv.headers[1..]
languages.each { |lang| hash[lang] = {} }
csv.each do |row|
languages.each do |lang|
- hash[lang][row["key"]] = row[lang] unless row[lang].nil?
+ hash[lang][row[@keys_column]] = row[lang] unless row[lang].nil?
end
end
Logger.info("Google Sheet parsed successfully!")
Logger.info("Found #{languages.count} languages.")