GithubHelp home page GithubHelp logo

mrmans0n / localio Goto Github PK

View Code? Open in Web Editor NEW
138.0 138.0 48.0 92 KB

Automatically create localizable files for Android, iOS, Rails, Java, Windows apps and more!

License: MIT License

Ruby 77.54% HTML 22.46%

localio's People

Contributors

debris avatar ejameslin avatar juanghurtado avatar luismacb avatar manuelschmitzberger avatar marcoslunar avatar mrmans0n avatar vzsg 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

localio's Issues

Update google-api-client dependency to > 0.9

Hey there!

I use your tool for iOS development in order to localize all my strings. Lately I've moved my deploys to fastlane in order to automate my builds. I would like to integrate localio as one step inside fastlane but there is a dependency issue with google-api-client:

Bundler could not find compatible versions for gem "google-api-client":
  In Gemfile:
    google-api-client (< 0.9)

    fastlane was resolved to 2.3.0, which depends on
      google-api-client (~> 0.9.1)

Is this possible?

Happy new year 🎉

Conversion Between iOS & Android String Format

Sorry if I overlooked the documentation, just wonder if localio does auto conversion between Android and iOS string formats? For example, cell value of name: %@ is converted to:

  • Android: name: %s
  • iOS: name: %@

Error when selecting source "xlsx"

When configuring the source as "xlsx", localio only detects one language, the first column. I tested with the same file exported to "xls" and it works great.

Could not find any [key] keyword in the A column of the CSV file

I have this error but all is well configured.
Why?
Service: csv
Invalid format: Could not find any [key] keyword in the A column of the CSV file

[key];en;it
hi;Hi;Ciao
platform :swift
formatting :none
output_path '../Resources/Translations'
source :csv,
       :path => 'pippo.csv',
       :column_separator => ';'

error while importing xlsx with localio 0.1.7

Hi guys,

with localio 0.1.7, importing xlsx file, we have this error:

Service: xlsx undefined method downcase' for nil:NilClass`

When reverted to 0.1.6 everything starts to work fine again.
Thanks

Alberto

Option for custom .strings file name?

Let me know if I'm wrong but I wasn't able to find how to specify a custom name for the generated .strings file. We have multiple string tables and need to have a name other than Localizable.strings. Would you be able to add that as a configurable parameter?

Please remove "_" before key

Thank you for creating localio,
however, my generated Localizable.string file has its key prefixed with "_". I don't understand why my key can not be as same as in excel file.
Could you fix this issue?

Insufficient Permission

Hi.

I've tryed to run "localize" and putted the URL, copy the code, paste it on the terminal, but at the end, it shows the error:

"Insufficient Permission: Request had insufficient authentication scopes."

At this point everytime I try to run "localize" command, I received this return without prompting Google Drive URL to try again.

Paste output:


Service: google_drive
Logging in to Google Drive...
Refreshing auth token...
Store auth data...
Logged in!
Insufficient Permission: Request had insufficient authentication scopes.


How can I force it to retry full flow?

Thanks

Build error when selecting swift platform

In Xcode 6.4 & iOS 8, the generated file "LocalizableConstants.swift" doesn't compile.

I was going to submit a PR myself, but I don't have credentials. To fix this, you only need to add "import Foundation" to the "swift_constant_localizable.erb" template.

invalid multibyte char (US-ASCII) error

I get this error when using localise:

$ localize
/usr/local/var/rbenv/versions/1.9.3-p429/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require': /usr/local/var/rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/localio-0.0.12/lib/localio/writers/android_writer.rb:39: invalid multibyte char (US-ASCII) (SyntaxError) /usr/local/var/rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/localio-0.0.12/lib/localio/writers/android_writer.rb:39: invalid multibyte char (US-ASCII) /usr/local/var/rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/localio-0.0.12/lib/localio/writers/android_writer.rb:39: syntax error, unexpected $end, expecting ')' term.gsub('&', '&amp;').gsub('...', '…').gsub('%@', '%s') ^ from /usr/local/var/rbenv/versions/1.9.3-p429/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from /usr/local/var/rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/localio-0.0.12/lib/localio/localizable_writer.rb:1:in <top (required)>' from /usr/local/var/rbenv/versions/1.9.3-p429/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from /usr/local/var/rbenv/versions/1.9.3-p429/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require' from /usr/local/var/rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/localio-0.0.12/lib/localio.rb:4:in<top (required)>'
from /usr/local/var/rbenv/versions/1.9.3-p429/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require' from /usr/local/var/rbenv/versions/1.9.3-p429/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from /usr/local/var/rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/localio-0.0.12/bin/localize:3:in <top (required)>' from /usr/local/var/rbenv/versions/1.9.3-p429/bin/localize:23:inload'
from /usr/local/var/rbenv/versions/1.9.3-p429/bin/localize:23:in `

'

Any idea?

Thanks!

Couldn't define platform as both :ios and :swift

I need to generate strings and constants for both Objective-C and Swift. I tried to accomplish this by assigning platform :ios, :swift but this simply gives the error "no implicit conversion of Symbol into Integer". Is it possible to do this some other way?

ArgumentError: header field value cannot include CR/LF

Hello,
this is my Locfile:

platform :ios

output_path 'my_output_path/'

source :google_drive,
       :spreadsheet => '[Localizables] Localio example',
       :client_id => ENV['CLIENT_ID'],
       :client_secret => ENV['CLIENT_SECRET']

when I run localize I get the URL to open in order to activate the API and get the code (4/AADb3pZBF1LtZM6QHTQEW0j04A1-DF-yLp4Gd9lyFO-p_-jEGW1RbOs). When I paste the code I get the following:

Error: #<ArgumentError: header field value cannot include CR/LF>
Couldn't access Google Drive. Check your values for :client_id and :client_secret, and delete :access_token if present (you might need to refresh its value so please remove it)

I don't really know why. Could it be a encoding issue?

Thank you
Marco

Invalid credentials

I can successfully load the translation using OAuth, however a few minutes later I try and it says invalid credentials:

Logging in to Google Drive...
Logged in!
Spreadsheet found. Analyzing...
Languages detected: en, es -- using en as default.
Building terminology in memory...
Loaded!
Writing iOS translations...
 > en
 > es
 > LocalizableConstants.h
Done!

Logging in to Google Drive...
Logged in!
Invalid Credentials

Escape Quotes and New Lines

Hi, I'm trying to generate files for my iOS app.
I've noticed that double quotes aren't escaped.
Also, new lines within the translation are untouched, meaning the iOS code has syntax errors.

So I've modified the following in the ios_writer.rb

translation = term.values[lang].gsub('"', %q(\\\")).gsub("\n", "\\n")

Keep in mind that my Ruby knowledge is limited, so I'd like to know if there's a better way to do this, or if there's no actual bug within the gem and my approach is wrong.

Thank you,
Peter

"No implicit conversion of Symbol into String"

Hi,

Keep in mind that I have no experience with ruby, I'm just trying to generate translation files for my iOS app.

My Locfile uses a basic xlsx source:

platform :ios

output_path :'/absolute/path/to/project/'

source  :xlsx,
        :path => 'Strings.xlsx'

formatting :smart

When I run localize, I get:

Languages detected: en, ru, zh, fr, es, ar, pt, ja -- using en as default.
Building terminology in memory...
Loaded!
Writing iOS translations...
no implicit conversion of Symbol into String

So I've started debugging and I've changed the following in localio/writers/ios_writer.rb:

languages.keys.each do |lang|
      output_path = File.join(path**.to_s**, "#{lang}.lproj/")

and

if create_constants && !constant_segments.nil?
      TemplateHandler.process_template 'ios_constant_localizable.erb', path**.to_s**, 'LocalizableConstants.h', constant_segments
      puts ' > ' + 'LocalizableConstants.h'.yellow
    end

And now the I've successfully generated my files.

Question is: is my Locfile wrong? Is this an actual bug in the gem?

Thank you,
Peter

There should be a way to ignore empty cells in spreadsheet even if they have a key

Right now what happens is that if there is a cell in spreadsheet which doesn't have a value the localized strings are not generated and we get error mentioned below

undefined methodgsub' for nil:NilClass`

There should be an option to skip these cells so that localized strings are generated for the whole file and the cells which don't have a value are skipped.

The reason this is important is because sometime we don't use localized strings at all places and so they are left out as blank in the spreadsheet and if we use localio then it fails to generate localized strings.

Conflicts between Android and IOS translations

Hi;

I am using Localio for both Android and IOS translations.

Android do not accept apostrophes in the value field. So I needed to put quotes if it contains apostrophes.

But if I extract for IOS, it puts extra quotes and xcode doesn't accept that.

What can I do for such situation?

Plurals support

Support plurals in some way, taking into account:

  • zero
  • one
  • two
  • few
  • many
  • other

Option for Selecting which Worksheet in spreadsheet should be localized

it would be great if we have an option to pick a worksheet in the spreadsheet. Instead of just localizing the first worksheet the user should specify which worksheet he wants to localize using the name of worksheet.

Something like this

platform :android
output_path 'res/'
source :xlsx,
       :path => 'sheet.xlsx'
worksheet: "sheet3"

Problem with unicode and "&" in android

I have few unicode chars in my localizations file, for example: "& #x25BC;". Localio changing "&" in cell to "& amp;", and whole string is "& amp;#x25BC;" [without white spaces]. I've tried some escape characters, but none works.

Integration in fastlane

There is anyway to integrate localio in fastlane? I haved problems also setting variable environment CLIENT_SECRET and CLIENT_ID.
Any process to try to integrate localio in a fastlane task?

issue while localizing

Hi!
I found your project and it seems really interesting to me, but I have some issues making it work..
I prepared the following Locfile:

platform :ios

source :xls, :path => 'traduzioni.xls'
output_path 'sterilizzatrici/Localizables/'

formatting :smart 

and when I call localize it fails with this error message:

Languages detected: it, en, fr, de -- using en as default.
Building terminology in memory...
Loaded!
Writing iOS translations...
 > it
undefined method `replace_escaped' for nil:NilClass

Any idea what's going on? I am using

ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-darwin14.0]

and

localio (0.0.23)

line wrap

Unfortunately, if an excel cell contains a line wrap element, that moves into the Localizable.strings, and this occurs an invalid format. Is there any solution to remove the line breaks from the content?

Add java "properties" file type to the possible outputs

Add a new file type target, a java properties file for storing translations.

The idea would be to make a language_{iso_code}.properties files with the properties specified with the likes of:

# comment
key1=translation1
key2=translation2

The authorization link doesn't work anymore.

After typing in the command "localize", the URL provided under:
Logging in to Google Drive...
1. Open this page in your browser:

is not valid anymore. For example, the link could be something like below:
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=XXXXXX-XXXXXXXXXXXXXXXXX.apps.googleusercontent.com&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https://docs.google.com/feeds/https://www.googleapis.com/auth/drive%20https://spreadsheets.google.com/feeds

Google will give out an error of invalid scope (https://prnt.sc/qsil8s) Even if I managed to change the URL to get a verification code, later when I run the "localize" command, I always get the below error:

Service: google_drive
Logging in to Google Drive...
Refreshing auth token...
Store auth data...
Logged in!
Spreadsheet found. Analyzing...
Unable to retrieve the first worksheet from the spreadsheet. Are there any pages?

The same method works on my Mac, since I linked it before the URL has issues, but now when I'm trying to set up my windows, the URL has scope issues and the spreadsheet cannot be found...So i think it could be related to the URL. Can you help with this please? Thank you very much!

Value with add (+) or equals (=)

When adding a row on google drive spreadsheet starting with + or =, google asks you to add ' at the beginning so it doesn't treat the value as a formula, this char (') appears in the generated files.

Modify GoogleDrive login method

A warning appears when you use GoogleDrive:

WARNING: GoogleDrive.login is deprecated and will be removed in the next version. Use GoogleDrive.login_with_oauth instead.

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.