Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/twine.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Ludwig <sebastian@lurado.de>2016-03-27 00:24:39 +0300
committerSebastian Ludwig <sebastian@lurado.de>2016-03-31 23:36:06 +0300
commitb1b59f4f627b39dc4dc63f26c45cc09cb860e394 (patch)
treeaa229b827f19266338e05e46cc889df312ed874c
parent594fbfddcc0476e4f725b7b48f12e412d4fedec4 (diff)
Updated README
-rw-r--r--README.md77
1 files changed, 39 insertions, 38 deletions
diff --git a/README.md b/README.md
index 6699da0..36719ea 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Twine
-Twine is a command line tool for managing your strings and their translations. These strings are all stored in a master text file and then Twine uses this file to import and export strings in a variety of file types, including iOS and Mac OS X `.strings` files, Android `.xml` files, gettext `.po` files, and [jquery-localize][jquerylocalize] `.json` files. This allows individuals and companies to easily share strings across multiple projects, as well as export strings in any format the user wants.
+Twine is a command line tool for managing your strings and their translations. These are all stored in a master text file and then Twine uses this file to import and export localization files in a variety of types, including iOS and Mac OS X `.strings` files, Android `.xml` files, gettext `.po` files, and [jquery-localize][jquerylocalize] `.json` files. This allows individuals and companies to easily share translations across multiple projects, as well as export localization files in any format the user wants.
## Install
@@ -21,19 +21,19 @@ You can also run Twine directly from source. However, it requires [rubyzip][ruby
Make sure you run the `twine` executable at the root of the project as it properly sets up your Ruby library path. The `bin/twine` executable does not.
-## String File Format
+## Twine File Format
-Twine stores all of its strings in a single file. The format of this file is a slight variant of the [Git][git] config file format, which itself is based on the old [Windows INI file][INI] format. The entire file is broken up into sections, which are created by placing the section name between two pairs of square brackets. Sections are optional, but they are a recommended way of breaking your strings into smaller, more manageable chunks.
+Twine stores everything in a single file, the Twine data file. The format of this file is a slight variant of the [Git][git] config file format, which itself is based on the old [Windows INI file][INI] format. The entire file is broken up into sections, which are created by placing the section name between two pairs of square brackets. Sections are optional, but they are the recommended way of grouping your strings into smaller, more manageable chunks.
-Each grouping section contains N string definitions. These string definitions start with the string key placed within a single pair of square brackets. This string definition then contains a number of key-value pairs, including a comment, a comma-separated list of tags (which are used by Twine to select a subset of strings), and all of the translations.
+Each grouping section contains N definitions. These definitions start with the key placed within a single pair of square brackets. It then contains a number of key-value pairs, including a comment, a comma-separated list of tags and all of the translations.
### Placeholders
-Twine supports [`printf` style placeholders](https://en.wikipedia.org/wiki/Printf_format_string) with one peculiarity: `@` is used for strings instead of `s`. This is because Twine started out as a tool for iOS and OS X projects.
+Twine supports [`printf` style placeholders][printf] with one peculiarity: `@` is used for strings instead of `s`. This is because Twine started out as a tool for iOS and OS X projects.
### Tags
-Tags are used by Twine as a way to only work with a subset of your strings at any given point in time. Each string can be assigned zero or more tags which are separated by commas. Tags are optional, though highly recommended. You can get a list of all strings currently missing tags by executing the `validate-strings-file` command.
+Tags are used by Twine as a way to only work with a subset of your definitions at any given point in time. Each definition can be assigned zero or more tags which are separated by commas. Tags are optional, though highly recommended. You can get a list of all definitions currently missing tags by executing the [`validate-twine-file`](#validate-twine-file) command.
### Whitespace
@@ -41,7 +41,7 @@ Whitepace in this file is mostly ignored. If you absolutely need to put spaces a
### References
-If you want a key to inherit the values of another key, you can use a reference. Any property not specified for a key will be taken from the reference.
+If you want a definition to inherit the values of another definition, you can use a reference. Any property not specified for a definition will be taken from the reference.
### Example
@@ -83,7 +83,7 @@ If you want a key to inherit the values of another key, you can use a reference.
## Supported Output Formats
-Twine currently supports the following formats for outputting strings:
+Twine currently supports the following output formats:
* [iOS and OS X String Resources][applestrings] (format: apple)
* [Android String Resources][androidstrings] (format: android)
@@ -92,67 +92,67 @@ Twine currently supports the following formats for outputting strings:
* [Django PO Files][djangopo] (format: django)
* [Tizen String Resources][tizen] (format: tizen)
-If you would like to enable twine to create language files in another format, create an appropriate formatter in `lib/twine/formatters`.
+If you would like to enable Twine to create localization files in another format, read the wiki page on how to create an appropriate formatter.
## Usage
- Usage: twine COMMAND STRINGS_FILE [INPUT_OR_OUTPUT_PATH] [--lang LANG1,LANG2...] [--tags TAG1,TAG2,TAG3...] [--format FORMAT]
+ Usage: twine COMMAND TWINE_FILE [INPUT_OR_OUTPUT_PATH] [--lang LANG1,LANG2...] [--tags TAG1,TAG2,TAG3...] [--format FORMAT]
### Commands
#### `generate-string-file`
-This command creates an Apple or Android strings file from the master strings data file. If the output file would not contain any translations, twine will exit with an error.
+This command creates a localization file from the Twine data file. If the output file would not contain any translations, Twine will exit with an error.
- $ twine generate-string-file /path/to/strings.txt values-ja.xml --tags common,app1
- $ twine generate-string-file /path/to/strings.txt Localizable.strings --lang ja --tags mytag
- $ twine generate-string-file /path/to/strings.txt all-english.strings --lang en
+ $ twine generate-string-file /path/to/twine.txt values-ja.xml --tags common,app1
+ $ twine generate-string-file /path/to/twine.txt Localizable.strings --lang ja --tags mytag
+ $ twine generate-string-file /path/to/twine.txt all-english.strings --lang en
#### `generate-all-string-files`
-This command is a convenient way to call `generate-string-file` multiple times. It uses standard Mac OS X, iOS, and Android conventions to figure out exactly which files to create given a parent directory. For example, if you point it to a parent directory containing `en.lproj`, `fr.lproj`, and `ja.lproj` subdirectories, Twine will create a `Localizable.strings` file of the appropriate language in each of them. However, files that would not contain any translations will not be created; instead warnings will be logged to `stderr`. This is often the command you will want to execute during the build phase of your project.
+This command is a convenient way to call [`generate-string-file`](#generate-string-file) multiple times. It uses standard conventions to figure out exactly which files to create given a parent directory. For example, if you point it to a parent directory containing `en.lproj`, `fr.lproj`, and `ja.lproj` subdirectories, Twine will create a `Localizable.strings` file of the appropriate language in each of them. However, files that would not contain any translations will not be created; instead warnings will be logged to `stderr`. This is often the command you will want to execute during the build phase of your project.
- $ twine generate-all-string-files /path/to/strings.txt /path/to/project/locales/directory --tags common,app1
+ $ twine generate-all-string-files /path/to/twine.txt /path/to/project/locales/directory --tags common,app1
#### `consume-string-file`
-This command slurps all of the strings from a `.strings` or `.xml` file and incorporates the translated text into the master strings data file. This is a simple way to incorporate any changes made to a single file by one of your translators. It will only identify strings that already exist in the master data file.
+This command slurps all of the translations from a localization file and incorporates the translated strings into the Twine data file. This is a simple way to incorporate any changes made to a single file by one of your translators. It will only identify definitions that already exist in the data file.
- $ twine consume-string-file /path/to/strings.txt fr.strings
- $ twine consume-string-file /path/to/strings.txt Localizable.strings --lang ja
- $ twine consume-string-file /path/to/strings.txt es.xml
+ $ twine consume-string-file /path/to/twine.txt fr.strings
+ $ twine consume-string-file /path/to/twine.txt Localizable.strings --lang ja
+ $ twine consume-string-file /path/to/twine.txt es.xml
#### `consume-all-string-files`
-This command reads in a folder containing many `.strings` or `.xml` files. These files should be in a standard folder hierarchy so that twine knows the language of each file. When combined with the `--developer-language`, `--consume-comments`, and `--consume-all` flags, this command is a great way to create your initial strings data file from an existing iOS or Android project. Just make sure that you create a blank strings.txt file, first!
+This command reads in a folder containing many localization files. These files should be in a standard folder hierarchy so that Twine knows the language of each file. When combined with the `--developer-language`, `--consume-comments`, and `--consume-all` flags, this command is a great way to create your initial Twine data file from an existing project. Just make sure that you create a blank Twine data file first!
- $ twine consume-all-string-files strings.txt Resources/Locales --developer-language en --consume-all --consume-comments
+ $ twine consume-all-string-files twine.txt Resources/Locales --developer-language en --consume-all --consume-comments
#### `generate-loc-drop`
-This command is a convenient way to generate a zip file containing files created by the `generate-string-file` command. If a file would not contain any translated strings, it is skipped and a warning is logged to `stderr`. This command can be used to create a single zip containing a large number of strings in all languages which you can then hand off to your translation team.
+This command is a convenient way to generate a zip file containing files created by the [`generate-string-file`](#generate-string-file) command. If a file would not contain any translated strings, it is skipped and a warning is logged to `stderr`. This command can be used to create a single zip containing a large number of strings in all languages which you can then hand off to your translation team.
- $ twine generate-loc-drop /path/to/strings.txt LocDrop1.zip
- $ twine generate-loc-drop /path/to/strings.txt LocDrop2.zip --lang en,fr,ja,ko --tags common,app1
+ $ twine generate-loc-drop /path/to/twine.txt LocDrop1.zip
+ $ twine generate-loc-drop /path/to/twine.txt LocDrop2.zip --lang en,fr,ja,ko --tags common,app1
#### `consume-loc-drop`
-This command is a convenient way of taking a zip file and executing the `consume-string-file` command on each file within the archive. It is most often used to incorporate all of the changes made by the translation team after they have completed work on a localization drop.
+This command is a convenient way of taking a zip file and executing the [`consume-string-file`](#consume-string-file) command on each file within the archive. It is most often used to incorporate all of the changes made by the translation team after they have completed work on a localization drop.
- $ twine consume-loc-drop /path/to/strings.txt LocDrop2.zip
+ $ twine consume-loc-drop /path/to/twine_strings.txt LocDrop2.zip
-#### `validate-strings-file`
+#### `validate-twine-file`
-This command validates that the strings file can be parsed, contains no duplicate keys, and that all strings have at least one tag. It will exit with a non-zero status code if any of those criteria are not met.
+This command validates that the Twine data file can be parsed, contains no duplicate keys, and that no key contains invalid characters. It will exit with a non-zero status code if any of those criteria are not met.
- $ twine validate-strings-file /path/to/strings.txt
+ $ twine validate-twine-file /path/to/twine.txt
-## Creating Your First strings.txt File
+## Creating Your First Twine Data File
-The easiest way to create your first strings.txt file is to run the `consume-all-string-files` command. The one caveat is to first create a blank strings.txt file to use as your starting point. Then, just point the `consume-all-string-files` command at a directory in your project containing all of your iOS, OS X, or Android strings files.
+The easiest way to create your first Twine Data file is to run the [`consume-all-string-files`](#consume-all-string-files) command. The one caveat is to first create a blank file to use as your starting point. Then, just point the `consume-all-string-files` command at a directory in your project containing all of your localization files.
- $ touch strings.txt
- $ twine consume-all-string-files strings.txt Resources/Locales --developer-language en --consume-all --consume-comments
+ $ touch twine.txt
+ $ twine consume-all-string-files twine.txt Resources/Locales --developer-language en --consume-all --consume-comments
## Twine and Your Build Process
@@ -161,12 +161,12 @@ The easiest way to create your first strings.txt file is to run the `consume-all
It is easy to incorporate Twine right into your iOS and OS X app build processes.
1. In your project folder, create all of the `.lproj` directories that you need. It does not really matter where they are. We tend to put them in `Resources/Locales/`.
-2. Run the `generate-all-string-files` command to create all of the string files you need in these directories. For example,
+2. Run the [`generate-all-string-files`](#generate-all-string-files) command to create all of the string files you need in these directories. For example,
- $ twine generate-all-string-files strings.txt Resources/Locales/ --tags tag1,tag2
+ $ twine generate-all-string-files twine.txt Resources/Locales/ --tags tag1,tag2
- Make sure you point Twine at your strings data file, the directory that contains all of your `.lproj` directories, and the tags that describe the strings you want to use for this project.
-3. Drag the `Resources/Locales/` directory to the Xcode project navigator so that Xcode knows to include all of these strings files in your build.
+ Make sure you point Twine at your data file, the directory that contains all of your `.lproj` directories, and the tags that describe the definitions you want to use for this project.
+3. Drag the `Resources/Locales/` directory to the Xcode project navigator so that Xcode knows to include all of these `.strings` files in your build.
4. In Xcode, navigate to the "Build Phases" tab of your target.
5. Click on the "Add Build Phase" button and select "Add Run Script".
6. Drag the new "Run Script" build phase up so that it runs earlier in the build process. It doesn't really matter where, as long as it happens before the resources are copied to your bundle.
@@ -243,3 +243,4 @@ Many thanks to all of the contributors to the Twine project, including:
[jquerylocalize]: https://github.com/coderifous/jquery-localize
[djangopo]: https://docs.djangoproject.com/en/dev/topics/i18n/translation/
[tizen]: https://developer.tizen.org/documentation/articles/localization
+[printf]: https://en.wikipedia.org/wiki/Printf_format_string