Skip to content

Excel -> Unicode *.txt -> strings.xml in Android res/values

Notifications You must be signed in to change notification settings

heray1990/txt2xml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

txt2xml

txt2xml is a python script for converting an Excel table to strings.xml file in Android. An Excel table is easy to manage the translations of strings while strings.xml is used by Android system to get the strings.

How to use

Let's say we have an Excel table as bellow:

zh fr es de
Main.MenuShowHistory 历史 Historique Historial Verlauf
Main.MenuShowDownloads 下载 Téléchargements Descargas Downloads
Main.MenuPreferences 配置 Préférences Preferencias Einstellungen
PreferencesActivity.EnableJavascriptPreferenceSummary 如果不支持JavaScript,很多网站效果不能打开,建议打开. Active ou désactive le JavaScript. Activar o desactivar JavaScript. JavaScript ein-/ausschalten.

Note: The contents in first row of the table are language shortcode. The contents in first column of other rows are the name of strings in Android.

Save the table as a Unicode text(*.txt) file, for example, strings.txt.

Run the script:

python txt2xml.py strings.txt

Now, you will see it automatically created four new directories(values-zh/, values-fr/, values-es/, values-de/) with a separate strings.xml inside.

The contents of strings.xml in values-zh/:

<?xml version="1.0" ?>
<resources>
  <string name="Main.MenuShowHistory">历史</string>
  <string name="Main.MenuShowDownloads">下载</string>
  <string name="Main.MenuPreferences">配置</string>
  <string name="PreferencesActivity.EnableJavascriptPreferenceSummary">如果不支持JavaScript,很多网站效果不能打开,建议打开.</string>
</resources>

About

Excel -> Unicode *.txt -> strings.xml in Android res/values

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages