options 
set configuartion of using googlei18n/myanmar-tools
974665
function detector ({
  use_myanmartools = OPTIONS.detector.use_myanmartools,
  myanmartools_zg_threshold = [0.05, 0.95]
} = {}) {
  // Check types
  if (
    typeof myanmartools_zg_threshold[0] !== 'number'
    || typeof myanmartools_zg_threshold[1] !== 'number'
  ) {
    console.error('myanmartools_zg_threshold must be [number, number]')
    myanmartools_zg_threshold = OPTIONS.detector.myanmartools_zg_threshold
  }

  return {
    use_myanmartools: use_myanmartools,
    myanmartools_zg_threshold: myanmartools_zg_threshold
  }
}
788053
def set_lang(lang_code=None):
    """"""
    # Check if language is available.
    lang_code = lang_code or request.values.get('lang_code')
    languages = dict(current_app.extensions['invenio-i18n'].get_languages())
    if lang_code is None or lang_code not in languages:
        abort(404 if request.method == 'GET' else 400)

    # Set language in session.
    session[current_app.config['I18N_SESSION_KEY']] = lang_code.lower()

    # Redirect user back.
    target = get_redirect_target()
    if not target:
        endpoint = current_app.config['I18N_DEFAULT_REDIRECT_ENDPOINT']
        target = url_for(endpoint) if endpoint else '/'

    return redirect(target)
750177
function setOptions(options) {
  // clone to prevent interference
  options = _.cloneDeep(options);

  // set deep defaults
  options = _.defaultsDeep(options, defaults);

  // ensure `text` is a string
  if (!_.isString(options.text)) throw new Error('`text` must be a String');

  // ensure `fontNameOrPath` is a string and not blank
  if (!_.isString(options.fontNameOrPath) || s.isBlank(options.fontNameOrPath))
    throw new Error('`fontNameOrPath` must be a String and not blank');

  // convert font size in pixels to number
  // and remove px, so we just convert to digits only
  if (_.isString(options.fontSize))
    options.fontSize = parseFloat(options.fontSize);

  // round to nearest whole pixel
  options.fontSize = Math.round(options.fontSize);

  // ensure it's a number greater than 0
  if (!_.isNumber(options.fontSize) || options.fontSize <= 0)
    throw new Error(
      '`fontSize` must be a Number or String that is a valid number > than 0'
    );

  // ensure `fontColor` is a string
  if (!_.isString(options.fontColor) || s.isBlank(options.fontColor))
    throw new Error('`fontColor` must be a String and not blank');

  // ensure `backgroundColor` is a string
  if (
    !_.isString(options.backgroundColor) ||
    s.isBlank(options.backgroundColor)
  )
    throw new Error('`backgroundColor` must be a String and not blank');

  // ensure supportsFallback is a boolean else true
  if (!_.isBoolean(options.supportsFallback))
    throw new Error('`supportsFallback` must be a Boolean');

  // ensure resizeToFontSize is a boolean else true
  if (!_.isBoolean(options.resizeToFontSize))
    throw new Error('`resizeToFontSize` must be a Boolean');

  // ensure trim is a boolean else true
  if (!_.isBoolean(options.trim)) throw new Error('`trim` must be a Boolean');

  // ensure trimTolerance is a number else 10
  if (
    !_.isNumber(options.trimTolerance) ||
    options.trimTolerance < 1 ||
    options.trimTolerance > 99
  )
    throw new Error(
      '`trimTolerance` must be a Number between 1 and 99 inclusive'
    );

  // if `textToSvg.attributes.fill` is not set
  // then set it equal to `fontColor`
  if (!_.isString(options.textToSvg.attributes.fill))
    options.textToSvg.attributes.fill = options.fontColor;

  // if `textToSvg.fontSize` not set, then we will calculate
  // what the `fontSize` should be based off height of font
  if (!_.isNumber(options.textToSvg.fontSize))
    options.textToSvg.fontSize = options.fontSize;

  // if `fontNameOrPath` was not a valid font path (with smart detection)
  // then result to use `getClosestFontName` and `getFontPathByName`
  try {
    const ext = path.extname(options.fontNameOrPath);
    const fontName = path.basename(options.fontNameOrPath, ext);

    if (_.includes(fontExtensions, ext)) {
      const stats = fs.statSync(path.resolve(options.fontNameOrPath));
      if (!stats.isFile())
        throw new Error(
          `${path.resolve(options.fontNameOrPath)} was not a valid file`
        );

      options.fontPath = path.resolve(options.fontNameOrPath);
      options.fontName = fontName;
    } else {
      const fontDir = path.dirname(path.resolve(options.fontNameOrPath));

      let data = _.map(fontExtensions, ext => {
        const filePath = `${fontDir}/${fontName}.${ext}`;
        try {
          const stats = fs.statSync(filePath);
          return stats.isFile() ? filePath : false;
        } catch (error) {
          return false;
        }
      });

      // remove false matches
      data = _.compact(data);

      // if this was a directory path then throw an error that it was not found
      if (options.fontNameOrPath.indexOf(path.sep) !== -1 && data.length === 0)
        throw new Error(
          `\`fontNameOrPath\` "${options.fontNameOrPath}" file was not found`
        );

      if (data.length > 0) {
        options.fontName = fontName;
        options.fontPath = data[0];
      } else {
        options.fontName = getClosestFontName(options.fontNameOrPath);
        options.fontPath = getFontPathByName(options.fontName);
      }
    }

    return options;
  } catch (error) {
    throw error;
  }
}
251181
def assign_defaults(options)
      # Normalizes languages keys from symbols to strings
      normalize_language_keys(options)

      # Build a complete list of the required languages
      enabled_languages = detect_languages(options)

      # Get all languages used in existing settings
      (LOCALISED_VERSION_VALUES + LOCALISED_APP_VALUES).each do |key|
        current = options[key]
        next unless current && current.kind_of?(Hash)
        current.each do |language, value|
          enabled_languages << language unless enabled_languages.include?(language)
        end
      end

      # Check folder list (an empty folder signifies a language is required)
      ignore_validation = options[:ignore_language_directory_validation]
      Loader.language_folders(options[:metadata_path], ignore_validation).each do |lang_folder|
        next unless File.directory?(lang_folder) # We don't want to read txt as they are non localised
        language = File.basename(lang_folder)
        enabled_languages << language unless enabled_languages.include?(language)
      end

      return unless enabled_languages.include?("default")
      UI.message("Detected languages: " + enabled_languages.to_s)

      (LOCALISED_VERSION_VALUES + LOCALISED_APP_VALUES).each do |key|
        current = options[key]
        next unless current && current.kind_of?(Hash)

        default = current["default"]
        next if default.nil?

        enabled_languages.each do |language|
          value = current[language]
          next unless value.nil?

          current[language] = default
        end
        current.delete("default")
      end
    end
398630
function makeDefaultOptions() {
  return {
    baseUrl: "/djedi",
    batchInterval: 10, // ms
    defaultRender: state => {
      switch (state.type) {
        case "loading":
          return "Loading…";
        case "error":
          return `Failed to fetch content 😞 (${
            state.error.response != null ? state.error.response.status : -1
          })`;
        case "success":
          return state.content;
        // istanbul ignore next
        default:
          return null;
      }
    },
    fetch: defaultFetch,
    languages: {
      default: "en-us",
      additional: [],
    },
    uri: {
      defaults: {
        scheme: "i18n",
        namespace: "",
        path: "",
        ext: "txt",
        version: "",
      },
      namespaceByScheme: {
        i18n: "{language}",
        l10n: "local",
        g11n: "global",
      },
      separators: {
        scheme: "://",
        namespace: "@",
        path: "/",
        ext: ".",
        version: "#",
      },
    },
  };
}
111283
def set(self, section, option, value=None):
        
        if isinstance(section, bytes):
            section = section.decode('utf8')

        if isinstance(option, bytes):
            option = option.decode('utf8')

        if isinstance(value, bytes):
            value = value.decode('utf8')

        return super(VSGConfigParser, self).set(section, option, value)
795364
function ( options ) {
    // Some minimal defaults
    this.defaults = {
      "locale_data" : {
        "messages" : {
          "" : {
            "domain"       : "messages",
            "lang"         : "en",
            "plural_forms" : "nplurals=2; plural=(n != 1);"
          }
          // There are no default keys, though
        }
      },
      // The default domain if one is missing
      "domain" : "messages",
      // enable debug mode to log untranslated strings to the console
      "debug" : false
    };

    // Mix in the sent options with the default options
    this.options = _.extend( {}, this.defaults, options );
    this.textdomain( this.options.domain );

    if ( options.domain && ! this.options.locale_data[ this.options.domain ] ) {
      throw new Error('Text domain set to non-existent domain: `' + options.domain + '`');
    }
  }
773414
function (msg, domain, options) {
        var format = options.poFormat || '';
        var source = options.sourceDomain || 'en';
        if (msg.comments && msg.comments.flag) {
            format = msg.comments.flag;
        }
        var msgids = [msg.msgid, msg.msgid_plural];
        var msgstr = msg.msgstr;

        var icuPluralForms = this.getPluralsForDomain(domain);
        var icuSourcePluralForms = this.getPluralsForDomain(source);
        var icuId = '';
        var icuStr = '';
        
        if (format.match(/python-format/g) !== null) {
            icuId = this.pythonPluralToICU(msgids, icuSourcePluralForms);
            icuStr = this.pythonPluralToICU(msgstr, icuPluralForms);
        }
        else if (format.match(/c-format/g) !== null) {
            icuId = this.pythonPluralToICU(msgids, icuSourcePluralForms);
            icuStr = this.pythonPluralToICU(msgstr, icuPluralForms);
        }

        var icuObject = {'icuId': icuId, 'icuStr': icuStr};
        return icuObject;
    }
545672
def tra(label, desc = "", tokens = {}, options = {})
      if Tr8n::Config.enable_admin_translations?
        if Tr8n::Config.enable_admin_inline_mode?
          tr(label, desc, tokens, options)
        else
          trl(label, desc, tokens, options)
        end
      else
        Tr8n::Config.default_language.translate(label, desc, tokens, options)
      end
    end
408313
@Override
  public final void setLang(final Languages pLang) {
    this.lang = pLang;
    if (this.itsId == null) {
      this.itsId = new IdI18nUnitOfMeasure();
    }
    this.itsId.setLang(this.lang);
  }
1074901
function (resources) {
		'use strict';
		this.i18n = require('i18next');
		var sprintf = require('i18next-sprintf-postprocessor');
		this.i18n.use(sprintf).init({
			overloadTranslationOptionHandler: sprintf.overloadTranslationOptionHandler,
			returnObjects: true,
			lng: this.locale,
			resources: resources
		});
	}
172157
def v2_translator(self, option):
        
        new_option = option
        new_value = getattr(self, option)

        renaming_pairs = {
            "dontfrag": "dont_fragment",
            "maxhops": "max_hops",
            "firsthop": "first_hop",
            "use_NSID": "set_nsid_bit",
            "cd": "set_cd_bit",
            "do": "set_do_bit",
            "qbuf": "include_qbuf",
            "recursion_desired": "set_rd_bit",
            "noabuf": "include_abuf"
        }
        if option in renaming_pairs.keys():
            warninglog = (
                "DeprecationWarning: {0} option has been deprecated and "
                "renamed to {1}."
            ).format(option, renaming_pairs[option])
            print(warninglog)
            new_option = renaming_pairs[option]

        # noabuf was changed to include_abuf so we need a double-negative
        if option == "noabuf":
            new_value = not new_value

        return new_option, new_value
785599
private static void findTranslateOptions(String[] args, Map<String,Transformer> suffix_rules)
        throws ProblemException, ProblemException {

        for (int i = 0; i<args.length; ++i) {
            if (args[i].equals("-tr")) {
                if (i+1 >= args.length) {
                    throw new ProblemException("You have to specify a translate rule following -tr.");
                }
                String s = args[i+1];
                checkTranslatePattern(s);
                int ep = s.indexOf("=");
                String suffix = s.substring(0,ep);
                String classname = s.substring(ep+1);
                if (suffix_rules.get(suffix) != null) {
                    throw new ProblemException("You have already specified a "+
                                              "rule for the suffix "+suffix);
                }
                if (s.equals(".class")) {
                    throw new ProblemException("You cannot have a translator for .class files!");
                }
                if (s.equals(".java")) {
                    throw new ProblemException("You cannot have a translator for .java files!");
                }
                String extra = null;
                int exp = classname.indexOf(",");
                if (exp != -1) {
                    extra = classname.substring(exp+1);
                    classname = classname.substring(0,exp);
                }
                try {
                    Class<?> cl = Class.forName(classname);
                    Transformer t = (Transformer)cl.newInstance();
                    t.setExtra(extra);
                    suffix_rules.put(suffix, t);
                }
                catch (Exception e) {
                    throw new ProblemException("Cannot use "+classname+" as a translator!");
                }
            }
        }
    }
959191
private void setOption(String opt, String argument) {
        String[] option = { opt, argument };
        options.append(option);
    }
1137525
def set_language(self, lang):
        

        if lang in self.iso_6391:
            self.arguments.update({'lang': '%s' % lang})
        else:
            raise TwitterSearchException(1002)
484988
function setDefaultOptions (options) {
  const defaultOptions = {
    src: '**/*.php',
    globOpts: {},
    destFile: 'translations.pot',
    commentKeyword: 'translators:',
    headers: {
      'X-Poedit-Basepath': '..',
      'X-Poedit-SourceCharset': 'UTF-8',
      'X-Poedit-SearchPath-0': '.',
      'X-Poedit-SearchPathExcluded-0': '*.js'
    },
    defaultHeaders: true,
    noFilePaths: false,
    writeFile: true,
    gettextFunctions: [
      { name: '__' },
      { name: '_e' },
      { name: '_ex', context: 2 },
      { name: '_n', plural: 2 },
      { name: '_n_noop', plural: 2 },
      { name: '_nx', plural: 2, context: 4 },
      { name: '_nx_noop', plural: 2, context: 3 },
      { name: '_x', context: 2 },
      { name: 'esc_attr__' },
      { name: 'esc_attr_e' },
      { name: 'esc_attr_x', context: 2 },
      { name: 'esc_html__' },
      { name: 'esc_html_e' },
      { name: 'esc_html_x', context: 2 }
    ]
  };

  if (options.headers === false) {
    options.defaultHeaders = false;
  }

  options = Object.assign({}, defaultOptions, options);

  if (!options.package) {
    options.package = options.domain || 'unnamed project';
  }

  const functionCalls = {
    valid: [],
    contextPosition: {},
    pluralPosition: {}
  };

  options.gettextFunctions.forEach(function (methodObject) {
    functionCalls.valid.push(methodObject.name);

    if (methodObject.plural) {
      functionCalls.pluralPosition[ methodObject.name ] = methodObject.plural;
    }
    if (methodObject.context) {
      functionCalls.contextPosition[ methodObject.name ] = methodObject.context;
    }
  });

  options.functionCalls = functionCalls;

  return options;
}
188711
def assert_consistent_reg_options(exec_type, json_spec, executable_builder_exeception):
    
    reg_options_spec = json_spec.get('regionalOptions')
    json_fn = 'dxapp.json' if exec_type == 'app' else 'dxworkflow.json'

    if not isinstance(reg_options_spec, dict):
        raise executable_builder_exeception("The field 'regionalOptions' in  must be a mapping")
    if not reg_options_spec:
        raise executable_builder_exeception(
            "The field 'regionalOptions' in " + json_fn + " must be a non-empty mapping")
    regional_options_list = list(reg_options_spec.items())
    for region, opts_for_region in regional_options_list:
        if not isinstance(opts_for_region, dict):
            raise executable_builder_exeception("The field 'regionalOptions['" + region +
                            "']' in " + json_fn + " must be a mapping")
        if set(opts_for_region.keys()) != set(regional_options_list[0][1].keys()):
            if set(opts_for_region.keys()) - set(regional_options_list[0][1].keys()):
                with_key, without_key = region, regional_options_list[0][0]
                key_name = next(iter(set(opts_for_region.keys()) - set(regional_options_list[0][1].keys())))
            else:
                with_key, without_key = regional_options_list[0][0], region
                key_name = next(iter(set(regional_options_list[0][1].keys()) - set(opts_for_region.keys())))
            raise executable_builder_exeception(
                "All regions in regionalOptions must specify the same options; " +
                "%s was given for %s but not for %s" % (key_name, with_key, without_key)
            )

        if exec_type == 'app':
            for key in opts_for_region:
                if key in json_spec.get('runSpec', {}):
                    raise executable_builder_exeception(
                    key + " cannot be given in both runSpec and in regional options for " + region)