Overrides Rails' core I18n.t() function to produce a more helpful error message.
 The default one wreaks havoc with CSS and makes it hard to understand the problem.
341915
def t(key, options = {})
      if (val = super) =~ /class.+?translation_missing/
        val = val.to_s.gsub(/<span[^>]*>/, 'i18n: ').gsub('</span>', '').gsub(', ', '.')
      end

      val
    end
1137079
function grammarSyntaxError(matchFailure) {
  var e = new Error();
  Object.defineProperty(e, 'message', {get: function() { return matchFailure.message; }});
  Object.defineProperty(e, 'shortMessage', {get: function() {
    return 'Expected ' + matchFailure.getExpectedText();
  }});
  e.interval = matchFailure.getInterval();
  return e;
}
16350
function Message({backendError, translations, onCheckAgain}) {
  const {backendIsNotAvailable, checkAgain} = translations;

  const errorMessage = backendError.message ||
    (backendError.toString ? backendError.toString() : null);

  return (
    <div data-test="ring-backend-down-notification">
      <Group>
        <span className={styles.title}>{backendIsNotAvailable}</span>
        <Link onClick={onCheckAgain} data-test="check-again">{checkAgain}</Link>
      </Group>
      <div className={styles.error}>{errorMessage}</div>
    </div>
  );
}
674352
def translation_locale
      locale = @translation_locale || I18n.locale.to_s
      locale == I18n.default_locale.to_s ? nil : locale
    end
175264
function defaultError(view, location) {
	const code = (/^[45]\d\d$/).test(location.name) ? +location.name : 0;
	view.document.body['inner'+'HTML'] = `<h1 id="code"></h1><span id="message"></span>`
	+`<style> :root { background: #424F5A; filter: invert(1) hue-rotate(180deg); font-family: Segoe UI, Tahoma, sans-serif; } </style>`;
	view.document.querySelector('#message').textContent = code ? view.history.state && view.history.state.message || '' : `Unknown view "${ location.name }"`;
	view.document.querySelector('#code').textContent = code || 404;
	view.document.title = !code || code === 404 ? 'Not Found' : view.history.state && view.history.state.title || 'Error';
	!code && console.error(`Got unknown view "${ view.location.hash.slice(1) }"`);
	location.onChange(() => view.location.reload());
}
148035
def translation_for(locale)
      success = true
      tries ||= 3
      translation = self.translations.detect{ |t| t.locale == locale }
      return translation if translation
      return nil if self.new_record
      request = Net::HTTP::Get.new("/api/projects/#{Connection.api_key}/strings/#{self.id}/locales/#{locale}/translations.yaml")
      WebTranslateIt::Util.add_fields(request)
      begin
        response = Util.handle_response(Connection.http_connection.request(request), true, true)
        hash = YAML.load(response)
        return nil if hash.empty?
        translation = WebTranslateIt::Translation.new(hash)
        return translation
        
      rescue Timeout::Error
        puts "Request timeout. Will retry in 5 seconds."
        if (tries -= 1) > 0
          sleep(5)
          retry
        else
          success = false
        end
      end
      success
    end
104233
def show
      prevent_browser_caching
      cms_edit_links!
      with_email_locale do
        if @preview.respond_to?(:preview_mail)
          @mail, body     = mail_and_body
          @mail_body_html = render_to_string(inline: body, layout: 'rails_email_preview/email')
        else
          raise ArgumentError.new("#{@preview} is not a preview class, does not respond_to?(:preview_mail)")
        end
      end
    end
1126874
def initialize_with_i18n_routing(*args)
      initialize_without_i18n_routing(*args)

      # Add i18n_locale as valid conditions for Rack::Mount / And add also :locale, as Rails 3.0.4 removed it ...
      @valid_conditions = @set.instance_eval { @set }.instance_eval { @valid_conditions }
      [:i18n_locale, :locale].each do |k|
        @set.valid_conditions[k] = true if !@set.valid_conditions.has_key?(k)
      end

      # Extends the current RouteSet in order to define localized helper for named routes
      # When calling define_url_helper, it calls define_localized_url_helper too.
      if !@set.named_routes.respond_to?(:define_localized_url_helper)
        @set.named_routes.class_eval <<-END_EVAL, __FILE__, __LINE__ + 1
          alias_method :localized_define_url_helper, :define_url_helper
          def define_url_helper(route, name, kind, options)
            localized_define_url_helper(route, name, kind, options)
            define_localized_url_helper(route, name, kind, options)
          end
        END_EVAL

        @set.named_routes.extend I18nRouting::NamedRouteCollection
      end
    end
522964
public function enqueue_jquery_ui_i18n() {

		static $done = array();

		$types = array();

		switch ( static::$type ) {
			case 'time':
				$types[] = 'time';

				break;
			case 'date':
				$types[] = 'date';

				break;
			case 'datetime':
				$types[] = 'time';
				$types[] = 'date';

				break;
		}

		if ( in_array( 'date', $types, true ) && ! in_array( 'date', $done, true ) ) {
			if ( function_exists( 'wp_localize_jquery_ui_datepicker' ) ) {
				wp_localize_jquery_ui_datepicker();
			}

			$done[] = 'date';
		}

		if ( in_array( 'time', $types, true ) && ! in_array( 'time', $done, true ) ) {
			$locale = str_replace( '_', '-', get_locale() );

			// Local files.
			if ( ! file_exists( PODS_DIR . 'ui/js/timepicker/i18n/jquery-ui-timepicker-' . $locale . '.js' ) ) {
				// Fallback to the base language (non-region specific).
				$locale = substr( $locale, 0, strpos( $locale, '-' ) );
			}

			if ( ! wp_script_is( 'jquery-ui-timepicker-i18n-' . $locale, 'registered' ) && file_exists( PODS_DIR . 'ui/js/timepicker/i18n/jquery-ui-timepicker-' . $locale . '.js' ) ) {
				wp_enqueue_script( 'jquery-ui-timepicker-i18n-' . $locale, PODS_URL . 'ui/js/timepicker/i18n/jquery-ui-timepicker-' . $locale . '.js', array( 'jquery-ui-timepicker' ), '1.6.3' );
			}

			$done[] = 'time';
		}
	}
1288641
def error(message)
      puts message.prepend('✗ ').colorize(:light_red)
    end
266241
function I18NHtmlParser(_htmlParser, _translations, _translationsFormat) {
	          this._htmlParser = _htmlParser;
	          this._translations = _translations;
	          this._translationsFormat = _translationsFormat;
	      }
618417
function(errors, options) {
      options = options || {};

      var ret = []
        , prettify = options.prettify || v.prettify;
      errors.forEach(function(errorInfo) {
        var error = v.result(errorInfo.error,
            errorInfo.value,
            errorInfo.attribute,
            errorInfo.options,
            errorInfo.attributes,
            errorInfo.globalOptions);

        if (!v.isString(error)) {
          ret.push(errorInfo);
          return;
        }

        if (error[0] === '^') {
          error = error.slice(1);
        } else if (options.fullMessages !== false) {
          error = v.capitalize(prettify(errorInfo.attribute)) + " " + error;
        }
        error = error.replace(/\\\^/g, "^");
        error = v.format(error, {
          value: v.stringifyValue(errorInfo.value, options)
        });
        ret.push(v.extend({}, errorInfo, {error: error}));
      });
      return ret;
    }
403646
function normalizeConfig(config, locale) {
  // Set current locale of i18n context.
  if (config.i18n && (config.i18n.locales instanceof Array)) {
    config.metadata.global.$locale = locale || config.i18n.locales[0];
    config.metadata.global.$locales = config.i18n.locales;
    config.metadata.global.$route = function(s) { return helpers.getNormalizedPath(helpers.getLocalizedPath(s, locale, config.i18n.locales)); };
  }
  else {
    config.metadata.global.$route = function(s) { return helpers.getNormalizedPath(s); };
  }

  // Set defaults for metalsmith-layouts.
  if (!_.get(config, `layouts.directory`)) _.set(config, `layouts.directory`, path.join(config.src, `layouts`));
  _.merge(config.layouts, _.get(config, _.get(config, `layouts.engine`)));

  // Set defaults for metalsmith-in-place.
  _.merge(config.inPlace, _.get(config, _.get(config, `inPlace.engine`)));

  // Set defaults for metalsmith-permalinks.
  config.permalinks = { relative: false, linksets: [] };

  // Set defaults for metalsmith-pagination.
  config.pagination = {};

  // Set defaults for metalsmith-tags.
  if (config.tags) {
    if ((typeof config.tags.layout === `string`) && _.isEmpty(path.extname(config.tags.layout)))
      config.tags.layout = `${config.tags.layout}.${config.layouts.engine}`;

    if (typeof config.tags.path === `string` && _.isEmpty(path.extname(config.tags.path))) {
      if (!_.endsWith(config.tags.path, `/`)) config.tags.path = `${config.tags.path}/`;
      config.tags.path = `${config.tags.path}index.html`;
    }

    if (typeof config.tags.skipMetadata !== `boolean`) config.tags.skipMetadata = true;
  }

  // Set defaults for metalsmith-collections.
  if (config.collections) {
    for (let collectionName in config.collections) {
      const data = _.get(config.collections, collectionName);
      let pattern = _.get(data, `pattern`);
      let permalink = _.get(data, `permalink`) || path.join(collectionName, `:slug`);
      let date = _.get(data, `date`);
      let paginate = _.get(data, `paginate`);

      if (typeof data.layout !== `string`) data.layout = collectionName;

      if (_.isEmpty(path.extname(data.layout))) {
        data.layout = `${data.layout}.${config.layouts.engine}`;
      }

      if (data.metadata && (typeof data.metadata.layout === `string`) && _.isEmpty(path.extname(data.metadata.layout))) {
        data.metadata.layout = `${data.metadata.layout}.${config.layouts.engine}`;
      }

      if (paginate) {
        if ((typeof paginate.layout === `string`) && _.isEmpty(path.extname(paginate.layout)))
          paginate.layout = `${paginate.layout}.${config.layouts.engine}`;

        if (typeof paginate.path === `string` && _.isEmpty(path.extname(paginate.path))) {
          if (!_.endsWith(paginate.path, `/`)) paginate.path = `${paginate.path}/`;
          paginate.path = `${paginate.path}index.html`;
        }

        if (typeof paginate.first === `string` && _.isEmpty(path.extname(paginate.first))) {
          if (!_.endsWith(paginate.first, `/`)) paginate.first = `${paginate.first}/`;
          paginate.first = `${paginate.first}index.html`;
          paginate.noPageOne = true;
        }

        config.pagination[`collections.${collectionName}`] = paginate;
      }

      if (pattern) {
        config.metadata.collections[collectionName] = {
          pattern: pattern,
          metadata: _.merge(data.metadata || {}, {
            layout: data.layout
          })
        };
      }

      if (permalink) {
        if (_.startsWith(permalink, `/`)) permalink = permalink.substr(1);
        config.permalinks.linksets.push({
          match: { collection: collectionName },
          pattern: locale ? `${locale}/${permalink}` : permalink,
          date: date
        });
      }
    }
  }

  return config;
}
1154824
function createTranslator(i18n: Object): Translator {
  const i18nDefaultParams = {
    translations: {},
    localeData: {},
    locale: 'en',
    defaultLocale: 'en',
    logMissing: false,
    scope: '',
    ...i18n,
  };

  // Patch the native Intl native node API because it is only shipped with "en" locale by default.
  if (global.__SERVER__) {
    // $FlowIssue Intl is not available in Flow Core annotations
    Intl.NumberFormat = IntlPolyfill.NumberFormat;
    Intl.DateTimeFormat = IntlPolyfill.DateTimeFormat;
  }

  /* eslint-disable no-underscore-dangle */
  /**
   * Register relevant localeData if we're using the browser polyfill.
   * Note: IntlPolyfill overrides the Intl global if the polyfill is needed.
   */
  if (global.__CLIENT__) {
    if (typeof IntlPolyfill.__addLocaleData === 'function') {
      IntlPolyfill.__addLocaleData(i18nDefaultParams.localeData);
    }
  }
  /* eslint-enable no-underscore-dangle */

  const { translations, locale, defaultLocale, logMissing } = i18nDefaultParams;

  const translator = new Counterpart.Instance();
  const availableLanguages = [locale, defaultLocale];

  // register only two locales: the current and the default.
  // no needs to register all available locales,
  // if the user change the locale, we reload the entire page.
  availableLanguages.forEach((locale_) => {
    translator.registerTranslations(locale_, translations);
  });

  translator.setLocale(locale);

  // fall back to the default language when a translation
  // (or the pluralization function) is not found.
  translator.setFallbackLocale(defaultLocale);

  // use pipe separator in order to support dots in translations
  // Note: pipes are also used to handle our custom plural notation.
  // Counterpart will make nested dicts to handle plurals but everything works
  // as expected.
  translator.setSeparator('|');

  if (logMissing) {
    // display warning if the translation has not been found.
    const handleTranslationNotFound = (requestedLocale, key) => {
      warning(false, `Translation not found: ${requestedLocale} => "${key}"`);
    };
    translator.onTranslationNotFound(handleTranslationNotFound);
  }

  // translate texts
  // Enchance the translate function with namespace, fallback, ...
  const translate = enhanceTranslate(i18n.scope, translator.translate.bind(translator));

  // translate date
  // (to avoid different tz between server and client, consider that all dates
  // are UTC)
  const localize = (date) => (
    moment.utc(date).locale(locale)
  );

  /**
   * Create a `Intl.NumberFormat` with `options`.
   * Locale is auto injected from user configuration.
   */
  const createNumberFormat = (options = {}) =>
    // $FlowIssue
    new Intl.NumberFormat(locale, {
      // This would be the perfect place to define default currency
      // currency: null,
      ...options,
    });

  /**
   * Return the currency symbol according to current locale from it's ISO code.
   * Use the localeData provided by Intl polyfill to map.
   * @param string   currencyISO   Currency ISO string
   * @return string
   */
  const mapCurrencyISOToSymbol = (currencyISO) => {
    const { number } = i18nDefaultParams.localeData;
    if (number && number.currencies && number.currencies[currencyISO]) {
      return number.currencies[currencyISO];
    }

    return currencyISO;
  };

  return { translator, translate, localize, createNumberFormat, mapCurrencyISOToSymbol };
}
595439
def load_rails_i18n_pluralization!(locale)
      path = File.join(Gem::Specification.find_by_name('rails-i18n').gem_dir, 'rails', 'pluralization', "#{locale}.rb")
      eval(File.read(path), binding, path) # rubocop:disable Security/Eval
    end
546558
def select
      @inline_translations_allowed = false
      @inline_translations_enabled = false
    
      if tr8n_current_user_is_translator? 
        unless tr8n_current_translator.blocked?
          @inline_translations_allowed = true
          @inline_translations_enabled = tr8n_current_translator.enable_inline_translations?
        end
      else
        @inline_translations_allowed = Tr8n::Config.open_registration_mode?
      end
    
      @inline_translations_allowed = true if tr8n_current_user_is_admin?
    
      @source_url = request.env['HTTP_REFERER']
      @source_url.gsub!("locale", "previous_locale") if @source_url
    
      @all_languages = Tr8n::Language.enabled_languages
      @user_languages = Tr8n::LanguageUser.languages_for(tr8n_current_user) unless tr8n_current_user_is_guest?
    
      render_lightbox
    end
387984
function getLocalESLintVersion() {
    try {
        const eslintPath = relativeModuleResolver("eslint", path.join(process.cwd(), "__placeholder__.js"));
        const eslint = require(eslintPath);

        return eslint.linter.version || null;
    } catch (_err) {
        return null;
    }
}