Name Description Size
__init__.py Module grit.format 199
android_xml.py Produces localized strings.xml files for Android. In cases where an "android" type output file is requested in a grd, the classes in android_xml will process the messages and translations to produce a valid strings.xml that is properly localized with the specified language. For example if the following output tag were to be included in a grd file <outputs> ... <output filename="values-es/strings.xml" type="android" lang="es" /> ... </outputs> for a grd file with the following messages: <message name="IDS_HELLO" desc="Simple greeting">Hello</message> <message name="IDS_WORLD" desc="The world">world</message> and there existed an appropriate xtb file containing the Spanish translations, then the output would be: <?xml version="1.0" encoding="utf-8"?> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <string name="hello">"Hola"</string> <string name="world">"mundo"</string> </resources> which would be written to values-es/strings.xml and usable by the Android resource framework. Advanced usage -------------- To process only certain messages in a grd file, tag each desired message by adding "android_java" to formatter_data. Then set the environmental variable ANDROID_JAVA_TAGGED_ONLY to "true" when building the grd file. For example: <message name="IDS_HELLO" formatter_data="android_java">Hello</message> To generate Android plurals (aka "quantity strings"), use the ICU plural syntax in the grd file. This will automatically be transformed into a <purals> element in the output xml file. For example: <message name="IDS_CATS"> {NUM_CATS, plural, =1 {1 cat} other {# cats}} </message> will produce <plurals name="cats"> <item quantity="one">1 Katze</item> <item quantity="other">%d Katzen</item> </plurals> 6890
android_xml_unittest.py How old fashioned -- she thought. 4987
c_format.py Formats as a .C file for compilation. 3166
c_format_unittest.py Unittest for c_format.py. 1999
chrome_messages_json.py Formats as a .json file that can be used to localize Google Chrome extensions. 1989
chrome_messages_json_unittest.py (<ph name="COUNT">%d<ex>2</ex></ph>) </message> <message name="IDS_ENDS_WITH_SPACE"> (<ph name="COUNT">%d<ex>2</ex></ph>) 5093
data_pack.py Support for formatting a data pack file used for platform agnostic resource files. 10596
data_pack_unittest.py Unit tests for grit.format.data_pack 4214
gen_predetermined_ids.py A tool to generate a predetermined resource ids file that can be used as an input to grit via the -p option. This is meant to be run manually every once in a while and its output checked in. See tools/gritsettings/README.md for details. 4798
gen_predetermined_ids_unittest.py Unit tests for the gen_predetermined_ids module. 1512
gzip_string.py Provides gzip utilities for strings. 1905
gzip_string_unittest.py Unit tests for grit.format.gzip_string 1843
html_inline.py Flattens a HTML file by inlining its external resources. This is a small script that takes a HTML file, looks for src attributes and inlines the specified file, producing one HTML file with no external dependencies. It recursively inlines the included files. 22598
html_inline_unittest.py Unit tests for grit.format.html_inline 26838
minifier.py Framework for stripping whitespace and comments from resource files 1173
policy_templates_json.py Translates policy_templates.json files. 847
policy_templates_json_unittest.py %s 6149
rc.py Support for formatting an RC file for compilation. 17987
rc_header.py Item formatters for RC headers. 1520
rc_header_unittest.py Unit tests for the rc_header formatter 5229
rc_unittest.py Unit tests for grit.format.rc 14613
resource_map.py This file contains item formatters for resource_map_header and resource_map_source files. A resource map is a mapping between resource names (string) and the internal resource ID. 4977
resource_map_unittest.py Unit tests for grit.format.resource_map 12704