Code Monkey home page Code Monkey logo

csv-localizer's Introduction

Convert CSV file to iOS and Android localizable string

csv-localizer

is a simple, fast, and fun command line interface writing in Python. The goal is to enable iOS and Android developers to save time doing the manual copy and paste in thier localizable strings list.

Requirements

CSV File in this format:

keys en zh ja

Sample CSV

keys en zh ja
pause_key paused 暂停 一時停止する
start_key start 开始 スタート
stop_key stop 停止 ストップ

Installation

csv-localizer can be installed from homebrew via

$ brew tap rogermolas/csv-localizer
$ brew install csv-localizer

Usage

csv-localizer use three required commands

Commands Descriptions
-p Platforms (ios, android, json)
-i Input directory, CSV files directory path
-o Output directory, Generated localizable files path
-d Delimiter used as seperation of values in the CSV file (example ':' or ',')
$ csv-localizer -p ios -i your_path/csv_files/ -o your_path/output

You can always get help and a full list of options with:

$ csv-localizer -h

Contributing

Bug fixes, improvements, and especially new implementations are welcome.

Workflow

  1. Fork.
  2. Make a feature/bugfix branch: git checkout -b my-feature
  3. Push your branch to your fork: git push -u origin my-feature
  4. Open GitHub, under "Your recently pushed branches", click Pull Request for my-feature.

License

Copyright 2018 Roger Molas

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

csv-localizer's People

Contributors

lmoesman avatar rogermolas 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

csv-localizer's Issues

LANG_KEYS Referenced Before Assignment

I am trying to run the tool for the first time, and I'm getting the following error:

Start Localizing ....
Generation output : Localisations/output
Traceback (most recent call last):
File "/usr/local/bin/csv-localizer", line 210, in
main(args, loglevel)
File "/usr/local/bin/csv-localizer", line 58, in main
generate_keys(IN_PATH, OUTPUT_DIR, PLATFORM)
File "/usr/local/bin/csv-localizer", line 105, in generate_keys
start_localize_ios(source_path, allwrites, LANG_KEYS)
UnboundLocalError: local variable 'LANG_KEYS' referenced before assignment

I checked /usr/local/bin/csv-localizer and on line 10 I can see the following:
LANG_KEYS = None #static will change later

Is there something missing here? How am I supposed to set LANG_KEYS ?

Integration with i18n service

Hi @rogermolas
I saw your post on reddit and I would like to help you with integration this plugin with my service.
https://simplelocalize.io Right now I'm preparing similar tool but in NodeJS, but your solution might be better for Android developers :)

Let me know what do you think. Of course I offer free of charge access to the system.

Getting error when trying to convert your sample file.

Getting the following error when trying to convert your sample file.



Valid source path, finding csv file ...


Validating target path ...


Valid target path, generating output directory ...


Using output directory: project/output




Platform : ios
Generated output directory: project/output
Traceback (most recent call last):
  File "/usr/local/bin/csv-localizer", line 271, in <module>
    main(args, loglevel)
  File "/usr/local/bin/csv-localizer", line 64, in main
    generate_keys(IN_PATH, OUTPUT_DIR, PLATFORM)
  File "/usr/local/bin/csv-localizer", line 115, in generate_keys
    start_localize_ios(source_path, allwrites, LANG_KEYS)
UnboundLocalError: local variable 'LANG_KEYS' referenced before assignment```

UnboundLocalError: local variable 'LANG_KEYS' referenced before assignment

I tried to convert the provided sample.csv (https://github.com/rogermolas/csv-localizer/blob/master/sample.csv) to ios localized strings using: csv-localizer -p ios -i sample.csv -o ios-output.
However I receive the following error and nothing is generated.
Any help would be much appreciated :)

Start Localizing ....


------------------------------------
Generated output directory: ios-output
Traceback (most recent call last):
  File "/Users/myuser/homebrew/bin/csv-localizer", line 278, in <module>
    main(args, loglevel)
  File "/Users/myuser/homebrew/bin/csv-localizer", line 70, in main
    generate_keys(IN_PATH, OUTPUT_DIR, PLATFORM, DELIMITER)
  File "/Users/myuser/homebrew/bin/csv-localizer", line 121, in generate_keys
    start_localize_ios(source_path, allwrites, LANG_KEYS, delimiter)
UnboundLocalError: local variable 'LANG_KEYS' referenced before assignment

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.