GithubHelp home page GithubHelp logo

netbe / babelish Goto Github PK

View Code? Open in Web Editor NEW
253.0 15.0 83.0 488 KB

Chaotically confused, like Babel

Home Page: http://netbe.github.io/Babelish

License: MIT License

Ruby 99.59% PHP 0.19% Dockerfile 0.15% HTML 0.07%
csv localisation ios android json

babelish's Introduction

Build Status Code ClimateCoverage Status Gem Version

Docker

Babelish : Chaotically confused, like Babel

Originally created to deal with localizedStrings files (aka CSV-to-iOS-Localizable.strings-converter), this command tool now converts a csv file of translations into the below file formats and vice-versa:

  • .strings (iOS)
  • .xml (Android)
  • .json
  • .php

It can also fetch the csv file from GoogleDrive.

Installation

gem install babelish

Requires Ruby 2.1.0 or above.

Or download Latest Release.

Or via docker: docker run netbe/babelish babelish help

Usage

› babelish help                                                                                                                                                          18:21:30
Commands:
  babelish android2csv     # Convert .xml files to CSV file
  babelish csv2android     # Convert CSV file to .xml
  babelish csv2json        # Convert CSV file to .json
  babelish csv2php         # Convert CSV file to .php
  babelish csv2strings     # Convert CSV file to .strings
  babelish csv_download    # Download Google Spreadsheet containing translations
  babelish help [COMMAND]  # Describe available commands or one specific command
  babelish init            # Create a configuration file from template
  babelish json2csv        # Convert .json files to CSV file
  babelish open FILE       # Open local csv file in default editor or Google Spreadsheet containing translations in default browser
  babelish php2csv         # Convert .php files to CSV file
  babelish strings2csv     # Convert .strings files to CSV file
  babelish version         # Display current version

Options:
      [--verbose], [--no-verbose]
  -c, [--config=CONFIG]            # Read configuration from given file
                                   # Default: .babelish

You can use a configuration file to hold all your commandline arguments into a file. Place a .babelish file (YAML) in your repo where you will run the command. In case you need to reset the Google Drive token you have to delete the .babelish.token file. See .babelish.sample file in the doc folder. as the possible values.

For previous CSV-to-iOS-Localizable.strings-converter, rename your .csvconverter into .babelish.

Note for docker: In order to export the output of a conversion, you will need to pipe the result out of the container. An example would be

› docker run netbe/babelish babelish csv2json >> some_file.json

For more details, check the documentation: https://github.com/netbe/Babelish/wiki/How-to-Use

Development

Run bundle install to install all the dependencies. Tests are done with Test::Unit so run rake test to run all the test suite.

Todo & Known issues

See GitHub issues

Privacy Policy

See related infos

babelish's People

Contributors

4brunu avatar bitdeli-chef avatar borut-t avatar fabioknoedt avatar fdelfrari avatar matthijspiek avatar moskvin avatar muratayusuke avatar neoklosch avatar netbe avatar nschum avatar powtac avatar snikolau avatar thii avatar zomfg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

babelish's Issues

problem converting using cvs2strings

Hi, i am trying to get a header with all the macros for localization in our project.

  1. I took our localization strings and used babelish to create cvs file. by running babelish strings2csv -i Localizable.strings
  2. Without modifications i know want to make a conversation back using babelish csv2strings -i translations.csv -L English:en however i am getting the following error
babelish csv2strings -i translations.csv -L English:en
/usr/local/lib/ruby/gems/2.2.0/gems/babelish-0.5.0/lib/babelish/csv2base.rb:139:in `block (2 levels) in convert': undefined method `add_content_pair' for nil:NilClass (NoMethodError)
    from /usr/local/lib/ruby/gems/2.2.0/gems/babelish-0.5.0/lib/babelish/csv2base.rb:113:in `times'
    from /usr/local/lib/ruby/gems/2.2.0/gems/babelish-0.5.0/lib/babelish/csv2base.rb:113:in `block in convert'
    from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/csv.rb:1739:in `each'
    from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/csv.rb:1122:in `block in foreach'
    from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/csv.rb:1273:in `open'
    from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/csv.rb:1121:in `foreach'
    from /usr/local/lib/ruby/gems/2.2.0/gems/babelish-0.5.0/lib/babelish/csv2base.rb:102:in `convert'
    from /usr/local/lib/ruby/gems/2.2.0/gems/babelish-0.5.0/lib/babelish/commandline.rb:153:in `block in csv2base'
    from /usr/local/lib/ruby/gems/2.2.0/gems/babelish-0.5.0/lib/babelish/commandline.rb:145:in `each'
    from /usr/local/lib/ruby/gems/2.2.0/gems/babelish-0.5.0/lib/babelish/commandline.rb:145:in `each_with_index'
    from /usr/local/lib/ruby/gems/2.2.0/gems/babelish-0.5.0/lib/babelish/commandline.rb:145:in `csv2base'
    from /usr/local/lib/ruby/gems/2.2.0/gems/babelish-0.5.0/lib/babelish/commandline.rb:37:in `block (2 levels) in <class:Commandline>'
    from /usr/local/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /usr/local/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /usr/local/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /usr/local/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /usr/local/lib/ruby/gems/2.2.0/gems/babelish-0.5.0/bin/babelish:6:in `<top (required)>'
    from /usr/local/bin/babelish:23:in `load'
    from /usr/local/bin/babelish:23:in `<main>'

Gem doesn't install cleanly

Installing the gem on OS X 10.9:

sudo gem install csv2strings

ends with:

Successfully installed csv2strings-0.2.2
ERROR:  While executing gem ... (TypeError)
    no implicit conversion of Array into String

and running csv2strings throws:

/Library/Ruby/Gems/2.0.0/gems/csv2strings-0.2.2/lib/csvconverter/commands/csv2strings_command.rb:39:in `csv2strings': uninitialized constant CSV2StringsCommand::CSV2Strings (NameError)
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
    from /Library/Ruby/Gems/2.0.0/gems/csv2strings-0.2.2/bin/csv2strings:5:in `'
    from /usr/bin/csv2strings:23:in `load'
    from /usr/bin/csv2strings:23:in `'

As a suggestion: .csv or Google Docs example

Hi @netbe,

Thanks for the nice library!
As a suggestion, could you add a .csv file and/or Google Docs file as example?
It would be nice to have a .csv file as example and how to call it to generate .strings files, for example.

I was wondering how to escape some rows and I couldn't find a way.

Cheers!

Special characters on google

Hey,

i want to have link on string file, but when i leave <a href="sherif-activity://sms-information-activity">to google spreadsheets then Babelish translate it to <a href=\"sherif-activity://sms-information-activity\">. Is there a way to leave the special character like a " make it Babelish " after translation (like a " in java string or in regex)?

Duplicate localisation keys

Because of the differences handling localisation files between platforms (iOS, Android) I've duplicated keys in csv file for some translations (handling translations with parameters) and than added excluded_states property to config file (iOS, Android) to exclude the ones that does not go with selected plaftform.

e.g.:

translationKey;number %d;iOS;
translationKey;number %1$d;Android;

Config in iOS project defines excluded_states: ["Android"].
Config in Android project defines excluded_states: ["iOS"].

Script always takes the last key (in above case for android) ingoring excluded_states. Is there a workaround?

Changing name of gem and project

Right now the name is csv2strings which would not make sense anymore with the Android, PHP and JSON support coming up.

  • Moving to csvconverter or something else
  • Also renaming the repo accordingly.

Better file not exists error handling

Similar to the xml error problem I got an error if the file I want to convert doesn't exist.
I got the following error:

$ babelish android2csv --filenames=/tmp/android.xml --csv-filename=/tmp/android_run2.csv --headers=Vars German

/home/neoklosch/ruby-projects/Babelish/lib/babelish/android2csv.rb:11:in `load_strings': No such file or directory (Errno::ENOENT)
from /home/neoklosch/ruby-projects/Babelish/lib/babelish/base2csv.rb:31:in `block in convert'
from /home/neoklosch/ruby-projects/Babelish/lib/babelish/base2csv.rb:29:in `each'
from /home/neoklosch/ruby-projects/Babelish/lib/babelish/base2csv.rb:29:in `convert'
from /home/neoklosch/ruby-projects/Babelish/lib/babelish/commandline.rb:165:in `base2csv'
from /home/neoklosch/ruby-projects/Babelish/lib/babelish/commandline.rb:56:in `block (2 levels) in <class:Commandline>'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /home/neoklosch/ruby-projects/Babelish/bin/babelish:6:in `<top (required)>'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/bin/babelish:23:in `load'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/bin/babelish:23:in `<main>'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'

A propper error handling would be helpful.

Choose which source file to extract comments from if they differ

First: This tool is great. I hate strings files and handling localization on iOS, it's absurdly bad, but this is making it a bit better.

I have English and Japanese strings files. My English file contains my (the developer) comments. The Japanese file contains some comments added by the translator, or at least the person responsible for sorting out the translation.

When I run:
babelish strings2csv

It extracts the comments only from the second file. If anything I'd prefer it to extract the comments from the first file, ideally though it would get both and put them in different columns.

Is there any way to specify which comments to use or use both?

Crashing when run

/Library/Ruby/Gems/2.0.0/gems/csv2strings-0.2.3/lib/csvconverter/strings2csv.rb:41:in strip!': invalid byte sequence in UTF-8 (ArgumentError) from /Library/Ruby/Gems/2.0.0/gems/csv2strings-0.2.3/lib/csvconverter/strings2csv.rb:41:inparse_dotstrings_line'
from /Library/Ruby/Gems/2.0.0/gems/csv2strings-0.2.3/lib/csvconverter/strings2csv.rb:33:in block (2 levels) in load_strings' from /Library/Ruby/Gems/2.0.0/gems/csv2strings-0.2.3/lib/csvconverter/strings2csv.rb:32:ineach_line'
from /Library/Ruby/Gems/2.0.0/gems/csv2strings-0.2.3/lib/csvconverter/strings2csv.rb:32:in block in load_strings' from /Library/Ruby/Gems/2.0.0/gems/csv2strings-0.2.3/lib/csvconverter/strings2csv.rb:31:inopen'
from /Library/Ruby/Gems/2.0.0/gems/csv2strings-0.2.3/lib/csvconverter/strings2csv.rb:31:in load_strings' from /Library/Ruby/Gems/2.0.0/gems/csv2strings-0.2.3/lib/csvconverter/strings2csv.rb:59:inblock in dotstrings_to_csv'
from /Library/Ruby/Gems/2.0.0/gems/csv2strings-0.2.3/lib/csvconverter/strings2csv.rb:57:in each' from /Library/Ruby/Gems/2.0.0/gems/csv2strings-0.2.3/lib/csvconverter/strings2csv.rb:57:indotstrings_to_csv'
from /Library/Ruby/Gems/2.0.0/gems/csv2strings-0.2.3/lib/csvconverter/commands/strings2csv_command.rb:19:in strings2csv' from /Library/Ruby/Gems/2.0.0/gems/thor-0.18.1/lib/thor/command.rb:27:inrun'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:120:in invoke_command' from /Library/Ruby/Gems/2.0.0/gems/thor-0.18.1/lib/thor.rb:363:indispatch'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.18.1/lib/thor/base.rb:439:in start' from /Library/Ruby/Gems/2.0.0/gems/csv2strings-0.2.3/bin/strings2csv:6:in<top (required)>'
from /usr/bin/strings2csv:23:in load' from /usr/bin/strings2csv:23:in

'

csv2android doesn't escape HTML correctly

Unfortunately, it seems that csv2android:

  1. doesn't escape HTML in the resulting XML and
  2. escapes quotes with backslashes

which makes it impossible to convert XML to CSV and back again to XML (presumably a common translation workflow).

Original XML with correctly escaped HTML:

  <string name="title">Title of &lt;a href="asd">File&lt;/a></string>

through android2csv results in:

title,"Title of <a href=""asd"">File</a>"

Converting it back to XML results in:

    <string name="title">Title of <a href=\"asd\">File</a></string>

Note the non-escaped < and the backslash escaped href attribute.

Converting it once again to CSV with android2csv then results in the following error:

    [...]/ruby-2.1.2/lib/ruby/2.1.0/rexml/parsers/baseparser.rb:373:in `pull_event':
    missing attribute quote (REXML::ParseException)
    Line: 4
    Position: 128
    Last 80 unconsumed characters:
    <a href=\"asd\">File</a></string> </resources>

With the manually fixed quotes the HTML tag gets truncated in the resulting CSV:

    title,Title of 

Support for comments and sections

Usual format of google spreadsheet:
keys, english, german, state_column, comments

csv2strings

  • put comments above translation
  • macro, comment should go to macro NSLocalizedStringFromTable(@"#{key}",@"#{table}",@"{comment}")

strings2csv

  • extract comment to new column

Cannot run rb script

OS : OS X 10.8.5
ruby : 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

park$ date '+%F %r'
2013-11-07 02:19:36 PM
park$ git status

On branch dev_Project-371

nothing to commit, working directory clean
park$ make translate
bundle exec csv2strings
/Users/park/Project/vendor/bundler/ruby/1.8/bundler/gems/mirror-CSV-to-iOS-Localizable.strings-converter-47ade2ded32c/lib/csvconverter.rb:4:in require': no such file to load -- orderedhash (LoadError) from /Users/park/Project/vendor/bundler/ruby/1.8/bundler/gems/mirror-CSV-to-iOS-Localizable.strings-converter-47ade2ded32c/lib/csvconverter.rb:4 from /Users/park/Project/vendor/bundler/ruby/1.8/bundler/gems/mirror-CSV-to-iOS-Localizable.strings-converter-47ade2ded32c/bin/csv2strings:4:inrequire'
from /Users/park/Project/vendor/bundler/ruby/1.8/bundler/gems/mirror-CSV-to-iOS-Localizable.strings-converter-47ade2ded32c/bin/csv2strings:4
from /Users/park/Project/vendor/bundler/ruby/1.8/bin/csv2strings:23:in `load'
from /Users/park/Project/vendor/bundler/ruby/1.8/bin/csv2strings:23
make: *** [translate] Error 1
park$
park$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

Operation not permitted

after upgrade mac os to el Capitan
-bash: babelish: command not found

install babelish :
sudo gem install babelish

ERROR:  While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/babelish

Download issue

I get "Could not download the requested file <file_id>" when firing csv_download command.

I've tried to set gDocs file name as "gd_filename" and also with absolute path but does not work. .babelish.token file has been successfully generated.

Is there something else I should set in config file beside "gd_filename", "output_filename" and "sheet" ?

Thanks

Better xml parser error handling

Catch xml parser in the android2csv command.
If I try to convert an malformed xml file i got the following error:

/home/neoklosch/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/rexml/parsers/baseparser.rb:340:in `pull_event': Missing end tag for 'p' (got "string") (REXML::ParseException)
Line: 10
Position: 649
Last 80 unconsumed characters:
from /home/neoklosch/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/rexml/parsers/baseparser.rb:184:in `pull'
from /home/neoklosch/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/rexml/parsers/treeparser.rb:22:in `parse'
from /home/neoklosch/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/rexml/document.rb:287:in `build'
from /home/neoklosch/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/rexml/document.rb:44:in `initialize'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/xml-simple-1.1.5/lib/xmlsimple.rb:971:in `new'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/xml-simple-1.1.5/lib/xmlsimple.rb:971:in `parse'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/xml-simple-1.1.5/lib/xmlsimple.rb:1013:in `load_xml_file'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/xml-simple-1.1.5/lib/xmlsimple.rb:186:in `xml_in'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/xml-simple-1.1.5/lib/xmlsimple.rb:203:in `xml_in'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/babelish-0.4.0/lib/babelish/android2csv.rb:13:in `load_strings'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/babelish-0.4.0/lib/babelish/base2csv.rb:31:in `block in convert'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/babelish-0.4.0/lib/babelish/base2csv.rb:29:in `each'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/babelish-0.4.0/lib/babelish/base2csv.rb:29:in `convert'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/babelish-0.4.0/lib/babelish/commandline.rb:165:in `base2csv'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/babelish-0.4.0/lib/babelish/commandline.rb:56:in `block (2 levels) in <class:Commandline>'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/gems/babelish-0.4.0/bin/babelish:6:in `<top (required)>'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/bin/babelish:23:in `load'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/bin/babelish:23:in `<main>'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
from /home/neoklosch/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'

A propper error handling would be helpful.

Update config file

  • change location of token: ~/.ruby_google_drive.token to .babelish.token
  • update infos about config file (options seem to be _ instead of -

config file keys_column

I added the .babelish.config file and the keys_column:2 because the keys in my google drive file starts from 2nd row.

this is my sructure:
Category | Key | English | Notes

Run babelish csv2strings -i "Project Language" -L English:en --fetch

the .string file looks like this
"category1" = "";
"category2" = "";
....

Did i miss something ?

csv2android do not use language region

Please change line 16 to this:

region = language.region.to_s.empty? ? "" : "-#{language.region}"
filepath = Pathname.new(@file_path) + "values-#{language.code}#{region}" + output_name

The Doclist API has been shut down

Suddenly I get the following error message when trying to download from google drive:

Fetching csv file [...] from Google Drive
/Users/[...]/.rvm/gems/ruby-2.1.1/gems/google_drive-0.3.11/lib/google_drive/session.rb:472:in `request': Response code 400 for get https://docs.google.com/feeds/default/private/full?v=3&title=[...]&title-exact=true: <errors xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>BadRequestException</code><internalReason>The Doclist API has been shut down. Please use the new Drive API, https://developers.google.com/drive/.</internalReason></error></errors> (GoogleDrive::Error)

android2csv: HTML tags are removed/not parsed correctly

HTML tags seem to get removed when converting to csv.

E.g.:
Android XML:

    <string name="title">Title of <b>this</b> file</string>

Through android2csv becomes:

    title,"[""Title of "", "" file""]"

missing

<b>this</b>

and generating what seems to be an array with too many quotes.

If the translation consists of only an html tag, the whole tag gets removed and replaced with empty quotes.

As far as I know html tags are allowed in Android's localization XML files.

strings2csv command crashes

I have installed by gem install csv2strings on ruby 1.9.3.

When I try to run a strings file through strings2csv I get this stack dump:

strings2csv --filenames=en.lproj/Localizable.strings -o=test.csv
/Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/gems/csv2strings-0.2.1/lib/strings2csv/converter.rb:31:in `merge!': can't convert nil into Hash (TypeError)
    from /Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/gems/csv2strings-0.2.1/lib/strings2csv/converter.rb:31:in `block (2 levels) in load_strings'
    from /Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/gems/csv2strings-0.2.1/lib/strings2csv/converter.rb:30:in `each_line'
    from /Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/gems/csv2strings-0.2.1/lib/strings2csv/converter.rb:30:in `block in load_strings'
    from /Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/gems/csv2strings-0.2.1/lib/strings2csv/converter.rb:29:in `open'
    from /Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/gems/csv2strings-0.2.1/lib/strings2csv/converter.rb:29:in `load_strings'
    from /Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/gems/csv2strings-0.2.1/lib/strings2csv/converter.rb:56:in `block in dotstrings_to_csv'
    from /Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/gems/csv2strings-0.2.1/lib/strings2csv/converter.rb:54:in `each'
    from /Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/gems/csv2strings-0.2.1/lib/strings2csv/converter.rb:54:in `dotstrings_to_csv'
    from /Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/gems/csv2strings-0.2.1/lib/strings2csv_command.rb:21:in `strings2csv'
    from /Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
    from /Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
    from /Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
    from /Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
    from /Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/gems/csv2strings-0.2.1/bin/strings2csv:5:in `<top (required)>'
    from /Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/bin/strings2csv:23:in `load'
    from /Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/bin/strings2csv:23:in `<main>'
    from /Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/bin/ruby_executable_hooks:15:in `eval'
    from /Users/enginkurutepe/.rvm/gems/ruby-1.9.3-p448/bin/ruby_executable_hooks:15:in `<main>'

The .strings file exists where it is supposed to. I have also tried using -i option with and without the equals sign. All with the same results.

Thanks a lot,
Engin.

CSV column separator style

For some reason Pages and Word exports to CSV with semicolon ";" column separator. On the other hand Google Docs exports with comma "," column separator.

Is it possible to define custom column separator?

Comments support on android

Is there a way to integrate comments into generated files on android like it already works on iOS ?

Thanks!

android2csv: CDATA content are removed

In an Android xml string file it's possible that an entry contains a CDATA block.

An example for that:
<string name="html"><![CDATA[<p>Text<p>]]></string>

After running the converter, the CDATA block is removed in the resulting csv.

result:
html,<p>Text<p>

If you convert the csv back to a xml the CDATA block is still missing and the xml file is completely wrong and it end in an error in android cause plain xml is not allowed.

result:
<string name="html"><p>Text<p></string>

Can not download from Google

When I run sudo babelish csv2strings -i "iOS_Translations" --fetch --verbose I get a 400 error from Google.

Fetching csv file iOS_Translations from Google Drive
/Library/Ruby/Gems/2.0.0/gems/google_drive-0.3.11/lib/google_drive/session.rb:472:in `request': Response code 400 for get https://docs.google.com/spreadsheets/d/14njfggrCyBliasdfg0yzf81tC7JWghf0QwH3dfg5fISM/export?usp=docslist_api&gid=0&format=csv: <!DOCTYPE html> [html message] </html>
    from /Library/Ruby/Gems/2.0.0/gems/google_drive-0.3.11/lib/google_drive/spreadsheet.rb:150:in `export_as_string'
    from /Library/Ruby/Gems/2.0.0/gems/google_drive-0.3.11/lib/google_drive/spreadsheet.rb:173:in `block in export_as_file'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open-uri.rb:36:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open-uri.rb:36:in `open'
    from /Library/Ruby/Gems/2.0.0/gems/google_drive-0.3.11/lib/google_drive/spreadsheet.rb:172:in `export_as_file'
    from /Library/Ruby/Gems/2.0.0/gems/babelish-0.3.3/lib/babelish/google_doc.rb:29:in `download_spreadsheet'
    from /Library/Ruby/Gems/2.0.0/gems/babelish-0.3.3/lib/babelish/google_doc.rb:20:in `block in download'
    from /Library/Ruby/Gems/2.0.0/gems/babelish-0.3.3/lib/babelish/google_doc.rb:19:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/babelish-0.3.3/lib/babelish/google_doc.rb:19:in `each_with_index'
    from /Library/Ruby/Gems/2.0.0/gems/babelish-0.3.3/lib/babelish/google_doc.rb:19:in `download'
    from /Library/Ruby/Gems/2.0.0/gems/babelish-0.3.3/lib/babelish/commandline.rb:100:in `download'
    from /Library/Ruby/Gems/2.0.0/gems/babelish-0.3.3/lib/babelish/commandline.rb:116:in `csv2base'
    from /Library/Ruby/Gems/2.0.0/gems/babelish-0.3.3/lib/babelish/commandline.rb:34:in `block (2 levels) in <class:Commandline>'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /Library/Ruby/Gems/2.0.0/gems/babelish-0.3.3/bin/babelish:6:in `<top (required)>'
    from /usr/bin/babelish:23:in `load'
    from /usr/bin/babelish:23:in `<main>'

The funny thing is, when I change the filename to a not existing file like, "iOS_Translations X" the output is Fetching csv file iOS_Translations X from Google Drive Could not download the requested file: iOS_Translations X

So it looks like I set up the token thing correctly.

Error on parse

I am getting this error with 0.1.5:

./convert.rb
Parsing filename : en.lproj/Localizable.strings
./convert.rb:32:in match': invalid byte sequence in US-ASCII (ArgumentError) from ./convert.rb:32:inmatch'
from ./convert.rb:32:in block (2 levels) in load_strings' from ./convert.rb:29:ineach_line'
from ./convert.rb:29:in block in load_strings' from ./convert.rb:28:inopen'
from ./convert.rb:28:in load_strings' from ./convert.rb:61:inblock in dotstrings_to_csv'
from ./convert.rb:58:in each' from ./convert.rb:58:indotstrings_to_csv'
from ./convert.rb:153:in `

'

Google docs SSL_connect issue on windows hosts

Hello,

we are having issues running Babelish when "fetch" property is set to "true".
This is the error we get:

C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:921:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (Faraday::SSLError)
        from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:921:in `block in connect'
        from C:/Ruby200-x64/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
        from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:921:in `connect'
        from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
        from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:851:in `start'
        from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1373:in `request'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:82:in `perform_request'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:40:in `block in call'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:87:in `with_net_http_connection'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:32:in `call'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb:15:in `call'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/faraday-0.9.2/lib/faraday/connection.rb:177:in `post'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/signet-0.7.2/lib/signet/oauth_2/client.rb:960:in `fetch_access_token'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/signet-0.7.2/lib/signet/oauth_2/client.rb:998:in `fetch_access_token!'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/google_drive-1.0.5/lib/google_drive.rb:154:in `saved_session'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/babelish-0.4.2/lib/babelish/google_doc.rb:45:in `authenticate'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/babelish-0.4.2/lib/babelish/google_doc.rb:50:in `file_with_name'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/babelish-0.4.2/lib/babelish/google_doc.rb:27:in `download_spreadsheet'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/babelish-0.4.2/lib/babelish/commandline.rb:116:in `download'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/babelish-0.4.2/lib/babelish/commandline.rb:135:in `csv2base'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/babelish-0.4.2/lib/babelish/commandline.rb:37:in `block (2 levels) in <class:Commandline>'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/babelish-0.4.2/bin/babelish:6:in `<top (required)>'
        from C:/Ruby200-x64/bin/babelish:23:in `load'
        from C:/Ruby200-x64/bin/babelish:23:in `<main>'

We've searched for solution with no luck. Could you take a look and suggest what to do?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.