[START translate_batch_translate_text_beta]
432498
static BatchTranslateResponse batchTranslateText(
      String projectId, String location, String sourceUri, String destinationUri) {
    try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {

      LocationName locationName =
          LocationName.newBuilder().setProject(projectId).setLocation(location).build();
      GcsSource gcsSource = GcsSource.newBuilder().setInputUri(sourceUri).build();
      InputConfig inputConfig =
          InputConfig.newBuilder().setGcsSource(gcsSource).setMimeType("text/plain").build();
      GcsDestination gcsDestination =
          GcsDestination.newBuilder().setOutputUriPrefix(destinationUri).build();
      OutputConfig outputConfig =
          OutputConfig.newBuilder().setGcsDestination(gcsDestination).build();
      BatchTranslateTextRequest batchTranslateTextRequest =
          BatchTranslateTextRequest.newBuilder()
              .setParent(locationName.toString())
              .setSourceLanguageCode("en")
              .addTargetLanguageCodes("sr")
              .addInputConfigs(inputConfig)
              .setOutputConfig(outputConfig)
              .build();

      // Call the API
      BatchTranslateResponse response =
          translationServiceClient
              .batchTranslateTextAsync(batchTranslateTextRequest)
              .get(300, TimeUnit.SECONDS);

      System.out.printf("Total Characters: %d\n", response.getTotalCharacters());
      System.out.printf("Translated Characters: %d\n", response.getTranslatedCharacters());
      return response;

    } catch (Exception e) {
      throw new RuntimeException("Couldn't create client.", e);
    }
  }
216904
def start_batch_learning(self):
        """"""
        self._learning = True

        self.graph.cursor().execute("PRAGMA journal_mode=memory")
        self.graph.drop_reply_indexes()
1324392
def babel_extract(config, input, output, target, keywords):
    
    click.echo(
        click.style(
            "Starting Extractions config:{0} input:{1} output:{2} keywords:{3}".format(
                config, input, output, keywords
            ),
            fg="green",
        )
    )
    keywords = " -k ".join(keywords)
    os.popen(
        "pybabel extract -F {0} -k {1} -o {2} {3}".format(
            config, keywords, output, input
        )
    )
    click.echo(click.style("Starting Update target:{0}".format(target), fg="green"))
    os.popen("pybabel update -N -i {0} -d {1}".format(output, target))
    click.echo(click.style("Finish, you can start your translations", fg="green"))
229106
function translate(content, langFile) {
  return content.replace(templateRegEx, function (match, capture) {
    return (0, _lodash2.default)(langMap.get(langFile), capture);
  });
}
684780
function(){
	var clauses = this.clauses = {
		where: {},
		order: {},
		paginate: {},
		id: {}
	};
	this.translators = {
		where: new Translate("where", {
			fromSet: function(set, setRemainder){
				return setRemainder;
			},
			toSet: function(set, wheres){
				return assign(set, wheres);
			}
		})
	};
	var self = this;
	each(arguments, function(arg) {

		if(arg) {
			if(arg instanceof Translate) {
				self.translators[arg.clause] = arg;
			} else {
				assign(clauses[arg.constructor.type || 'where'], arg);
			}
		}
	});
}
1144022
void doBatchStart(String batch, Object args) {
    checkOpen();
    JsonObject message = createMessage(args)
        .putString("batch", batch)
        .putString("action", "startBatch");
    if (open && !paused) {
      if (log.isDebugEnabled()) {
        log.debug(String.format("%s - Batch start: Batch[batch=%s]", this, batch));
      }
      eventBus.send(inAddress, message);
    }
    checkFull();
  }
1008860
def translate_zxcvbn_text(text):
    
    i18n = {
        "Use a few words, avoid common phrases": _(
            "Use a few words, avoid common phrases"
        ),
        "No need for symbols, digits, or uppercase letters": _(
            "No need for symbols, digits, or uppercase letters"
        ),
        "Add another word or two. Uncommon words are better.": _(
            "Add another word or two. Uncommon words are better."
        ),
        "Straight rows of keys are easy to guess": _(
            "Straight rows of keys are easy to guess"
        ),
        "Short keyboard patterns are easy to guess": _(
            "Short keyboard patterns are easy to guess"
        ),
        "Use a longer keyboard pattern with more turns": _(
            "Use a longer keyboard pattern with more turns"
        ),
        'Repeats like "aaa" are easy to guess': _(
            'Repeats like "aaa" are easy to guess'
        ),
        'Repeats like "abcabcabc" are only slightly harder to guess than "abc"': _(
            'Repeats like "abcabcabc" are only slightly harder to guess than "abc"'
        ),
        "Avoid repeated words and characters": _("Avoid repeated words and characters"),
        'Sequences like "abc" or "6543" are easy to guess': _(
            'Sequences like "abc" or "6543" are easy to guess'
        ),
        "Avoid sequences": _("Avoid sequences"),
        "Recent years are easy to guess": _("Recent years are easy to guess"),
        "Avoid recent years": _("Avoid recent years"),
        "Avoid years that are associated with you": _(
            "Avoid years that are associated with you"
        ),
        "Dates are often easy to guess": _("Dates are often easy to guess"),
        "Avoid dates and years that are associated with you": _(
            "Avoid dates and years that are associated with you"
        ),
        "This is a top-10 common password": _("This is a top-10 common password"),
        "This is a top-100 common password": _("This is a top-100 common password"),
        "This is a very common password": _("This is a very common password"),
        "This is similar to a commonly used password": _(
            "This is similar to a commonly used password"
        ),
        "A word by itself is easy to guess": _("A word by itself is easy to guess"),
        "Names and surnames by themselves are easy to guess": _(
            "Names and surnames by themselves are easy to guess"
        ),
        "Common names and surnames are easy to guess": _(
            "Common names and surnames are easy to guess"
        ),
        "Capitalization doesn't help very much": _(
            "Capitalization doesn't help very much"
        ),
        "All-uppercase is almost as easy to guess as all-lowercase": _(
            "All-uppercase is almost as easy to guess as all-lowercase"
        ),
        "Reversed words aren't much harder to guess": _(
            "Reversed words aren't much harder to guess"
        ),
        "Predictable substitutions like '@' instead of 'a' don't help very much": _(
            "Predictable substitutions like '@' instead of 'a' don't help very much"
        ),
    }
    translated_text = i18n.get(text)
    if translated_text is None:
        # zxcvbn is inconsistent, sometime there is a dot, sometime not
        translated_text = i18n.get(text[:-1])
    if translated_text is None:
        LOGGER.warning(
            "No translation for '%s' or '%s', update the generatei18ndict command.",
            text,
            text[:-1],
        )
        return text
    return translated_text
109483
function translate(id, filename, buffer, options, next) {
	var ext = (filename.match(extexp) || [])[1] || '',
		encoding = options.encoding || exports.defaults.encoding,
		trans = options.translate, js, nowrap;

	// make a list of what not to wrap
	nowrap = options.nowrap || exports.defaults.nowrap;
	nowrap = [ 'define', 'define.min', 'define.shim' ].concat(nowrap);
	// should this code get wrapped with a define?
	nowrap = nowrap.some(function(no) {
		return no.test ? no.test(id) : (no === id);
	});

	// convert commonjs to amd
	function wrap(err, js) {
		if (err) { return next(err); }

		var deps = exports.dependencies(id, js), params = [], undef = '';

		// make sure require, exports, and module are properly passed into the factory
		if (/\brequire\b/.test(js)) { params.push('require'); }
		if (/\bexports\b/.test(js)) { params.push('exports'); }
		if (/\bmodule\b/.test(js)) { params.push('module'); }

		// make sure code follows the `exports` path instead of `define` path once wrapped
		if (/\bdefine\.amd\b/.test(js)) { undef = 'var define;'; }

		if (deps.length) {
			deps = ',' + JSON.stringify(params.concat(deps));
		} else if (params.length) {
			params = [ 'require', 'exports', 'module' ];
		}

		js = 'define(' + JSON.stringify(id) + deps + ',function(' + params + ')' +
				'{' + js + '\n' + undef + '}' + // rely on hoisting for define
			');\n';
		next(null, js);
	}

	// find the translate function
	trans = trans && (trans[filename] || trans[id] || trans[ext]);
	if (trans) { // user configured translation
		return trans(
			{ id:id, filename:filename, buffer:buffer },
			options, (nowrap ? next : wrap)
		);
	}

	js = buffer.toString(encoding);

	// handle javascript files
	if ('js' === ext) {
		return (nowrap ? next : wrap)(null, js);
	}

	// handle non-javascript files
	if ('json' !== ext) { js = JSON.stringify(js); } // export file as json string
	if (nowrap) { return next(null, 'return ' + js); }
	return next(null, 'define(' + JSON.stringify(id) + ',' + js + ');\n');
}
668431
function (text, arg1, arg2, arg3) {
    text = translateWord(text);

    var pos = text.indexOf('%s');
    if (pos !== -1) {
        text = text.replace('%s', arg1);
    } else {
        return text;
    }

    pos = text.indexOf('%s');
    if (pos !== -1)  {
        text = text.replace('%s', arg2);
    } else {
        return text;
    }

    pos = text.indexOf('%s');
    if (pos !== -1)  {
        text = text.replace('%s', arg3);
    }

    return text;
}
735883
private function insertDefault() : void
    {
        // Insert default languages
        $this->batchInsert($this->table, [
            'slug', 'name',       'locale',     'alias',
            'icon', 'created_at', 'updated_at', 'created_by', 'updated_by'
        ],
        [
            ['ru', 'Русский', 'ru_RU', 'ru',  'ru', time(), time(), 1, 1],
            ['en', 'English', 'en_GB', 'en',  'gb', time(), time(), 1, 1],
        ]);
    }
195420
void translate() {
            make.at(pos.getStartPosition());
            JCClassDecl owner = classDef((ClassSymbol)mapVar.owner);

            // synthetic static final int[] $SwitchMap$Color = new int[Color.values().length];
            MethodSymbol valuesMethod = lookupMethod(pos,
                                                     names.values,
                                                     forEnum.type,
                                                     List.nil());
            JCExpression size = make // Color.values().length
                .Select(make.App(make.QualIdent(valuesMethod)),
                        syms.lengthVar);
            JCExpression mapVarInit = make
                .NewArray(make.Type(syms.intType), List.of(size), null)
                .setType(new ArrayType(syms.intType, syms.arrayClass));

            // try { $SwitchMap$Color[red.ordinal()] = 1; } catch (java.lang.NoSuchFieldError ex) {}
            ListBuffer<JCStatement> stmts = new ListBuffer<>();
            Symbol ordinalMethod = lookupMethod(pos,
                                                names.ordinal,
                                                forEnum.type,
                                                List.nil());
            List<JCCatch> catcher = List.<JCCatch>nil()
                .prepend(make.Catch(make.VarDef(new VarSymbol(PARAMETER, names.ex,
                                                              syms.noSuchFieldErrorType,
                                                              syms.noSymbol),
                                                null),
                                    make.Block(0, List.nil())));
            for (Map.Entry<VarSymbol,Integer> e : values.entrySet()) {
                VarSymbol enumerator = e.getKey();
                Integer mappedValue = e.getValue();
                JCExpression assign = make
                    .Assign(make.Indexed(mapVar,
                                         make.App(make.Select(make.QualIdent(enumerator),
                                                              ordinalMethod))),
                            make.Literal(mappedValue))
                    .setType(syms.intType);
                JCStatement exec = make.Exec(assign);
                JCStatement _try = make.Try(make.Block(0, List.of(exec)), catcher, null);
                stmts.append(_try);
            }

            owner.defs = owner.defs
                .prepend(make.Block(STATIC, stmts.toList()))
                .prepend(make.VarDef(mapVar, mapVarInit));
        }
381966
protected function getInlineJavaScriptTranslations()
    {
        $dismiss_text = Swat::_('Dismiss message.');
        $select_an_action_text = Swat::_('Please select an action.');
        $select_an_item_text = Swat::_('Please select one or more items.');
        $select_an_item_and_an_action_text = Swat::_(
            'Please select an action, and one or more items.'
        );

        return sprintf(
            "SwatActions.dismiss_text = '%s';\n" .
                "SwatActions.select_an_action_text = '%s';\n" .
                "SwatActions.select_an_item_text = '%s';\n" .
                "SwatActions.select_an_item_and_an_action_text = '%s';\n",
            $dismiss_text,
            $select_an_action_text,
            $select_an_item_text,
            $select_an_item_and_an_action_text
        );
    }
58792
def bmrblex(text):
    
    stream = transform_text(text)

    wordchars = (u"abcdfeghijklmnopqrstuvwxyz"
                 u"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
                 u"ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ"
                 u"ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ"
                 u"!@$%^&*()_+:;?/>.<,~`|\{[}]-=")

    whitespace = u" \t\v\r\n"
    comment = u"#"
    state = u" "
    token = u""
    single_line_comment = u""

    while len(stream) > 0:
        nextnextchar = stream.popleft()

        while True:
            nextchar = nextnextchar

            if len(stream) > 0:
                nextnextchar = stream.popleft()
            else:
                nextnextchar = u""

            # Process multiline string, comment, or single line comment
            if len(nextchar) > 1:
                state = u" "
                token = nextchar
                break  # emit current token

            elif nextchar in whitespace and nextnextchar in comment and state not in (u"'", u'"'):
                single_line_comment = u""
                state = u"#"

            if state is None:
                token = u""  # past end of file
                break

            elif state == u" ":
                if not nextchar:
                    state = None
                    break

                elif nextchar in whitespace:
                    if token:
                        state = u" "
                        break  # emit current token
                    else:
                        continue

                elif nextchar in wordchars:
                    token = nextchar
                    state = u"a"

                elif nextchar == u"'" or nextchar == u'"':
                    token = nextchar
                    state = nextchar

                else:
                    token = nextchar
                    if token:
                        state = u" "
                        break  # emit current token
                    else:
                        continue

            # Process single-quoted or double-quoted token
            elif state == u"'" or state == u'"':
                token += nextchar
                if nextchar == state:
                    if nextnextchar in whitespace:
                        state = u" "
                        token = token[1:-1]  # remove single or double quotes from the ends
                        break

            # Process single line comment
            elif state == u"#":
                single_line_comment += nextchar
                if nextchar == u"\n":
                    state = u" "
                    break

            # Process regular (unquoted) token
            elif state == u"a":
                if not nextchar:
                    state = None
                    break
                elif nextchar in whitespace:
                    state = u" "
                    if token:
                        break  # emit current token
                    else:
                        continue
                else:
                    token += nextchar

        if nextnextchar:
            stream.appendleft(nextnextchar)

        yield token
        token = u""
363423
function translate(cond, queryObj) {

    let result = {};

    // If condition is not an array...
    if (!Array.isArray(cond)) {
        //...then it is a condition cluster
        if (cond.and) {
            result = translateAndList(cond.and, queryObj)
        }
        else if (cond.or) {
            result = translateOrList(cond.or, queryObj)
        }
        else {
            //This is an illegal subject.
            throw new Error('Invalid query Object keys. Objects must be either "and" or "or"');
        }
    }
    else {
        //...then it's a singular condition
        assert(cond.length === 3, 'Invalid condition item. Condition items must be an array of 3 items representing field, comparator, and value')

        let fieldName = cond[0];
        if (fieldName === 'id') {
            fieldName = '_key';
        }
        fieldName = fieldName.replace('.*', '[*]');

        let comp = cond[1];
        let value = cond[2];

        // construct mini block
        if (comp === 'like' || comp === 'nlike') {

            value = '%' + value + '%';

        }

        const paramName = 'p' + Object.keys(queryObj.bindVars).length;
        const valueName = 'v' + Object.keys(queryObj.bindVars).length;

        const aqlComp = convertComp(comp);

        result = `c.@${paramName} ${aqlComp} @${valueName}`;

        queryObj.bindVars[paramName] = fieldName;
        queryObj.bindVars[valueName] = value;

    }

    return result;

}
111311
def translate_command(val):
    '''
    
    '''
    if isinstance(val, six.string_types):
        return val
    elif isinstance(val, list):
        for idx in range(len(val)):
            if not isinstance(val[idx], six.string_types):
                val[idx] = six.text_type(val[idx])
    else:
        # Make sure we have a string
        val = six.text_type(val)
    return val
890515
function translate (content, contentTypes) {
  let output = {}
  content.forEach(each => {
    const base = path.parse(each.file).base
    if (base === 'index.md') {
      const type = each.dir.split('/').pop()
      const contentTypeTranslation = contentTypes.find(contentType => contentType[type])
      if (contentTypeTranslation && contentTypeTranslation[type]) {
        output[type] = contentTypeTranslation[type](content, type)
      }
    }
  })
  return output
}
30772
def convert_translations(self, dest_dir):
        
        if not os.path.isdir(dest_dir):
            os.makedirs(dest_dir)
        total_translation_rows = 0
        with open(os.path.join(dest_dir, 'translations.txt'),
                  'w+b') as out_file:
            writer = csv.DictWriter(
                out_file, fieldnames=NEW_TRANSLATIONS_FIELDS)
            writer.writeheader()
            for filename in sorted(os.listdir(self.src_dir)):
                if not (filename.endswith('.txt') and
                        os.path.isfile(os.path.join(self.src_dir, filename))):
                    print('Skipping %s' % filename)
                    continue
                table_name = filename[:-len('.txt')]
                if table_name == 'translations':
                    continue
                total_translation_rows += self._translate_table(
                    dest_dir, table_name, writer)
        print('Total translation rows: %s' % total_translation_rows)