Skip to content

Commit

Permalink
Merge pull request #118 from filippodelfra/hotfix/android_region_and_…
Browse files Browse the repository at this point in the history
…default

Android Region Management
  • Loading branch information
netbe authored Nov 15, 2019
2 parents 3bd79f8 + 860677e commit 15e0160
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/babelish/csv2android.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def language_filepaths(language)
require 'pathname'
output_name = "strings.xml"
output_name = "#{@output_basename}.xml" unless @output_basename.empty?
filepath = Pathname.new(@file_path) + "values-#{language.code}" + output_name
region = language.region.to_s.empty? ? "" : "-r#{language.region}"
filepath = Pathname.new(@file_path) + "values-#{language.code}#{region}" + output_name
return filepath ? [filepath] : []
end

Expand Down
15 changes: 15 additions & 0 deletions test/babelish/commands/test_command_csv2android.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ def test_csv2android_with_multiple_2_languages
system("rm -rf ./values-fr/")
end

def test_csv2android_with_multiple_2_languages_with_region
options = {
:filename => "test/data/test_data_multiple_langs.csv",
:langs => {"English" => "en-US", "French" => "fr"}
}
Commandline.new([], options).csv2android

assert File.exist?("./values-en-rUS/strings.xml")
assert File.exist?("./values-fr/strings.xml")

# clean up
system("rm -rf ./values-en-rUS/")
system("rm -rf ./values-fr/")
end

def test_csv2android_with_output_dir
options = {
:filename => "test/data/test_data_multiple_langs.csv",
Expand Down

0 comments on commit 15e0160

Please sign in to comment.