Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow to save modes in the .tx/config file.

  • Loading branch information...
commit ada6ecc86deafc43a4255998972dec9ed8df7fdb 1 parent ecf9c44
Apostolos Bessas authored
Showing with 15 additions and 6 deletions.
  1. +8 −6 txclib/parsers.py
  2. +7 −0 txclib/project.py
View
14 txclib/parsers.py
@@ -201,12 +201,14 @@ def set_parser():
"in order to download it."
)
)
- # parser.add_option(
- # "--mode", action="store", dest="mode", help=(
- # "Specify that only reviewed strings of the translations "
- # "should be downloaded."
- # )
- # )
+ parser.add_option(
+ "--mode", action="store", dest="mode", help=(
+ "Specify the mode of the translation file to pull (e.g. "
+ "'reviewed'). See http://help.transifex.net/features/client/"
+ "index.html#defining-the-mode-of-the-translated-file for the"
+ "available values."
+ )
+ )
group = OptionGroup(parser, "Extended options", "These options can only be"
" used with the --auto-local command.")
group.add_option("-s","--source-language", action="store",
View
7 txclib/project.py
@@ -324,6 +324,8 @@ def pull(self, languages=[], resources=[], overwrite=True, fetchall=False,
lang_map = self.get_resource_lang_mapping(resource)
host = self.get_resource_host(resource)
logger.debug("Language mapping is: %s" % lang_map)
+ if mode is None:
+ mode = self._get_option(resource, 'mode')
self.url_info = {
'host': host,
'project': project_slug,
@@ -333,6 +335,7 @@ def pull(self, languages=[], resources=[], overwrite=True, fetchall=False,
stats = self._get_stats_for_resource()
+
try:
file_filter = self.config.get(resource, 'file_filter')
except ConfigParser.NoOptionError:
@@ -1180,6 +1183,10 @@ def set_min_perc(self, resources, perc):
"""Set the minimum percentage for the resources."""
self._set_resource_option(resources, key='minimum_perc', value=perc)
+ def set_default_mode(self, resources, mode):
+ """Set the default mode for the specified resources."""
+ self._set_resource_option(resources, key='mode', value=mode)
+
def _set_resource_option(self, resources, key, value):
"""Set options in the config file.
Please sign in to comment.
Something went wrong with that request. Please try again.