chiark / gitweb /
server: move strings to be gettext translatable
authorHans-Christoph Steiner <hans@eds.org>
Fri, 29 Sep 2017 15:49:48 +0000 (17:49 +0200)
committerHans-Christoph Steiner <hans@eds.org>
Fri, 13 Oct 2017 12:58:15 +0000 (14:58 +0200)
fdroidserver/server.py

index aa15284f6e28f5161ba4270b6803571c09e119a9..391656544dfe364b7802bc86ce13f47bcfec41f3 100644 (file)
@@ -69,7 +69,8 @@ def update_awsbucket_s3cmd(repo_section):
     to use a full MD5 checksum of all files to detect changes.
     '''
 
-    logging.debug('using s3cmd to sync with ' + config['awsbucket'])
+    logging.debug(_('Using s3cmd to sync with: {url}')
+                  .format(url=config['awsbucket']))
 
     configfilename = '.s3cfg'
     fd = os.open(configfilename, os.O_CREAT | os.O_TRUNC | os.O_WRONLY, 0o600)
@@ -129,7 +130,8 @@ def update_awsbucket_libcloud(repo_section):
     Requires AWS credentials set in config.py: awsaccesskeyid, awssecretkey
     '''
 
-    logging.debug('using Apache libcloud to sync with ' + config['awsbucket'])
+    logging.debug(_('using Apache libcloud to sync with {url}')
+                  .format(url=config['awsbucket']))
 
     import libcloud.security
     libcloud.security.VERIFY_SSL_CERT = True
@@ -138,7 +140,7 @@ def update_awsbucket_libcloud(repo_section):
 
     if not config.get('awsaccesskeyid') or not config.get('awssecretkey'):
         raise FDroidException(
-            'To use awsbucket, you must set awssecretkey and awsaccesskeyid in config.py!')
+            _('To use awsbucket, awssecretkey and awsaccesskeyid must also be set in config.py!'))
     awsbucket = config['awsbucket']
 
     cls = get_driver(Provider.S3)
@@ -147,7 +149,8 @@ def update_awsbucket_libcloud(repo_section):
         container = driver.get_container(container_name=awsbucket)
     except ContainerDoesNotExistError:
         container = driver.create_container(container_name=awsbucket)
-        logging.info('Created new container "' + container.name + '"')
+        logging.info(_('Created new container "{name}"')
+                     .format(name=container.name))
 
     upload_dir = 'fdroid/' + repo_section
     objs = dict()
@@ -403,7 +406,7 @@ def update_servergitmirrors(servergitmirrors, repo_section):
                 repo.git.add(all=True)
                 repo.index.commit("fdroidserver git-mirror: Deploy to GitLab Pages")
 
-            logging.debug('Pushing to ' + remote.url)
+            logging.debug(_('Pushing to {url}').format(url=remote.url))
             with repo.git.custom_environment(GIT_SSH_COMMAND=ssh_cmd):
                 pushinfos = remote.push('master', force=True, set_upstream=True, progress=progress)
                 for pushinfo in pushinfos:
@@ -540,7 +543,8 @@ def push_binary_transparency(git_repo_path, git_remote):
     '''
     import git
 
-    logging.info('Pushing binary transparency log to ' + git_remote)
+    logging.info(_('Pushing binary transparency log to {url}')
+                 .format(url=git_remote))
 
     if os.path.isdir(os.path.dirname(git_remote)):
         # from offline machine to thumbdrive
@@ -628,17 +632,17 @@ def main():
             logging.error(_('local_copy_dir must be directory, not a file!'))
             sys.exit(1)
         if not os.path.exists(os.path.dirname(fdroiddir)):
-            logging.error('The root dir for local_copy_dir "'
-                          + os.path.dirname(fdroiddir)
-                          + '" does not exist!')
+            logging.error(_('The root dir for local_copy_dir "{path}" does not exist!')
+                          .format(path=os.path.dirname(fdroiddir)))
             sys.exit(1)
         if not os.path.isabs(fdroiddir):
             logging.error(_('local_copy_dir must be an absolute path!'))
             sys.exit(1)
         repobase = os.path.basename(fdroiddir)
         if standardwebroot and repobase != 'fdroid':
-            logging.error('local_copy_dir does not end with "fdroid", '
-                          + 'perhaps you meant: ' + fdroiddir + '/fdroid')
+            logging.error(_('local_copy_dir does not end with "fdroid", '
+                            + 'perhaps you meant: "{path}"')
+                          .format(path=fdroiddir + '/fdroid'))
             sys.exit(1)
         if local_copy_dir[-1] != '/':
             local_copy_dir += '/'