No commit activity in last 3 years
No release in over 3 years
A simple gem to localize strings.xml files in android
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

>= 0

Runtime

 Project Readme

StringsXmlLocalizer Build Status

A very simple gem to translate contents of a strings.xml file from one locale to another. It could be used for localize your app.

Installation

Add this line to your application's Gemfile:

gem 'strings_xml_localizer'

And then execute:

$ bundle

Or install it yourself as:

$ gem install strings_xml_localizer

Usage

First, require it in your file:

require 'strings_xml_localizer'

Localize from a string and receive output as a string:

input = %Q(
  <?xml version="1.0" encoding="utf-8"?>
  <resources>
      <string name="hello">Hello!</string>
      <string name="hi">Hello!</string>
  </resources>
)
StringsXmlLocalizer.string_to_string(input, tl: :ja)

### OUTPUT
# "\n<resources>\n  <string name=\"hello\">こんにちは!</string>\n  <string name=\"hi\">こんにちは!</string>\n</resources>\n"
###

Localize from a string and write output to file

StringsXmlLocalizer.string_to_file(input, to: 'my_output.xml')

Localize from a file and receive output as a string

StringsXmlLocalizer.file_to_string(input, from: 'input.xml')

Localize from a file and write output to file

StringsXmlLocalizer.file_to_file(from: 'input.xml', to: 'output.xml')

Options:

  • :from: File to read from, default: strings.xml
  • :to: File to write to, default: output.xml
  • :sl: Source language, default: auto
  • :tl: Target language, default: en

Contributing

  1. Fork it ( http://github.com/hoangphanea/strings_xml_localizer/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request