Loads localisation files and routes actions depending on the 'action' query var.
540336
public function action_init() {
		load_plugin_textdomain( 'user-switching', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );

		if ( ! isset( $_REQUEST['action'] ) ) {
			return;
		}

		$current_user = ( is_user_logged_in() ) ? wp_get_current_user() : null;

		switch ( $_REQUEST['action'] ) {

			// We're attempting to switch to another user:
			case 'switch_to_user':
				if ( isset( $_REQUEST['user_id'] ) ) {
					$user_id = absint( $_REQUEST['user_id'] );
				} else {
					$user_id = 0;
				}

				// Check authentication:
				if ( ! current_user_can( 'switch_to_user', $user_id ) ) {
					wp_die( esc_html__( 'Could not switch users.', 'user-switching' ) );
				}

				// Check intent:
				check_admin_referer( "switch_to_user_{$user_id}" );

				// Switch user:
				$user = switch_to_user( $user_id, self::remember() );
				if ( $user ) {
					$redirect_to = self::get_redirect( $user, $current_user );

					// Redirect to the dashboard or the home URL depending on capabilities:
					$args = array(
						'user_switched' => 'true',
					);

					if ( $redirect_to ) {
						wp_safe_redirect( add_query_arg( $args, $redirect_to ), 302, self::$application );
					} elseif ( ! current_user_can( 'read' ) ) {
						wp_safe_redirect( add_query_arg( $args, home_url() ), 302, self::$application );
					} else {
						wp_safe_redirect( add_query_arg( $args, admin_url() ), 302, self::$application );
					}
					exit;
				} else {
					wp_die( esc_html__( 'Could not switch users.', 'user-switching' ) );
				}
				break;

			// We're attempting to switch back to the originating user:
			case 'switch_to_olduser':
				// Fetch the originating user data:
				$old_user = self::get_old_user();
				if ( ! $old_user ) {
					wp_die( esc_html__( 'Could not switch users.', 'user-switching' ) );
				}

				// Check authentication:
				if ( ! self::authenticate_old_user( $old_user ) ) {
					wp_die( esc_html__( 'Could not switch users.', 'user-switching' ) );
				}

				// Check intent:
				check_admin_referer( "switch_to_olduser_{$old_user->ID}" );

				// Switch user:
				if ( switch_to_user( $old_user->ID, self::remember(), false ) ) {

					if ( ! empty( $_REQUEST['interim-login'] ) ) {
						$GLOBALS['interim_login'] = 'success'; // @codingStandardsIgnoreLine
						login_header( '', '' );
						exit;
					}

					$redirect_to = self::get_redirect( $old_user, $current_user );
					$args        = array(
						'user_switched' => 'true',
						'switched_back' => 'true',
					);

					if ( $redirect_to ) {
						wp_safe_redirect( add_query_arg( $args, $redirect_to ), 302, self::$application );
					} else {
						wp_safe_redirect( add_query_arg( $args, admin_url( 'users.php' ) ), 302, self::$application );
					}
					exit;
				} else {
					wp_die( esc_html__( 'Could not switch users.', 'user-switching' ) );
				}
				break;

			// We're attempting to switch off the current user:
			case 'switch_off':
				// Check authentication:
				if ( ! current_user_can( 'switch_off' ) ) {
					/* Translators: "switch off" means to temporarily log out */
					wp_die( esc_html__( 'Could not switch off.', 'user-switching' ) );
				}

				// Check intent:
				check_admin_referer( "switch_off_{$current_user->ID}" );

				// Switch off:
				if ( switch_off_user() ) {
					$redirect_to = self::get_redirect( null, $current_user );
					$args        = array(
						'switched_off' => 'true',
					);

					if ( $redirect_to ) {
						wp_safe_redirect( add_query_arg( $args, $redirect_to ), 302, self::$application );
					} else {
						wp_safe_redirect( add_query_arg( $args, home_url() ), 302, self::$application );
					}
					exit;
				} else {
					/* Translators: "switch off" means to temporarily log out */
					wp_die( esc_html__( 'Could not switch off.', 'user-switching' ) );
				}
				break;

		}
	}
326038
protected function loadRoutes()
    {
        if (($routes = $this->app['config']['http.routes']) == null) {
            return;
        }

        $router = $this->app['router'];

        $namespace = $this->getNamespace();

        foreach ($routes as $route) {
            if ($route instanceof Closure) {
                // We can defined routes with a Closure.
                call_user_func($route, $router);

                continue;
            }

            $attributes = $this->normalizeRouteAttributes($route);

            $filePath = array_pull($attributes, 'path');

            if ($namespace) {
                $attributes['namespace'] = $this->getGroupRouteNamespace($namespace, $attributes);
            }

            if (file_exists($filePath)) {
                $router->group($attributes, function ($router) use ($filePath) {
                    include $filePath;
                });
            }
        }
    }
1075515
def translate_uri(request)
			@@empty_check ||= Regexp.new('^/?$')
			@@lang_check ||= Regexp.new('^/[a-z]{2}(/|$)')
      uri = request.path
      request.uri ||= uri
      config = config(request)
      handle_shortcut(request, config)
      case uri
      when @@empty_check
        request.uri = config['redirect']['/'] ||= @handler_uri
      when @@lang_check
        begin
          self.parse_uri(request)
        rescue LoadError # this happens often
          res = simple_parse_uri(request)
        end
        request.uri = @handler_uri
      end
      Apache::DECLINED
		end
89820
protected static function load()
    {
        $files = glob(root().'resources/translator/'.self::$lang.'/*.php');

        foreach ($files as $file) {
            $words = need($file);

            // get file name
            $filename = explode('resources/translator/'.self::$lang.'/', $file);
            $filename = $filename[1];
            $filename = explode('.php', $filename);
            $filename = $filename[0];

            foreach ($words as $key => $value) {
                if ($filename == self::$lang) {
                    self::$words[$key] = $value;
                } else {
                    self::$words[$filename][$key] = $value;
                }
            }
        }
    }
530663
def localized(locales = I18n.available_locales, opts = {})
      # Add if not added Rails.root/config/locales/*.yml in the I18n.load_path
      if !@i18n_routing_path_set and defined?(Rails) and Rails.respond_to?(:root) and Rails.root
        I18n.load_path = (I18n.load_path << Dir[Rails.root.join('config', 'locales', '*.yml')]).flatten.uniq
        @i18n_routing_path_set = true
      end

      old_value = @locales
      @locales = locales
      @i18n_verbose ||= opts.delete(:verbose)
      yield
    ensure
      @locales = old_value
    end
149950
protected function loadActions()
    {
        $reflection = new \ReflectionClass($this);
        $actionNamespace = $reflection->name . '\\';
        $actionDirectory = get_class_name($reflection->name);
        $actionsPath = dirname($reflection->getFileName()) . DIRECTORY_SEPARATOR . $actionDirectory . DIRECTORY_SEPARATOR;

        foreach (glob($actionsPath . '*.php') as $filePath) {
            if (is_file($filePath)) {
                $commandClassName = $actionNamespace . pathinfo($filePath, PATHINFO_FILENAME);
                $this->addCommander(new $commandClassName);
            }
        }
    }
1039081
function loadTranslation(localeFilePath) {
    if(typeof localeFilePath == "undefined"){
        messages = defaultMessages;
        return null;
    }
    let fp = path.join(__dirname, localeFilePath);
    messages = require('jsonfile').readFileSync("." + fp);
    return messages;
}
596874
private function scanAndSaveTranslations()
    {
        // Scan translations
        $this->info('Scanning codebase and storing all translations');

        $this->strReplaceInFile(config_path('admin-translations.php'),
            '// here you can add your own directories',
            '// here you can add your own directories
        // base_path(\'routes\'), // uncomment if you have translations in your routes i.e. you have localized URLs
        base_path(\'vendor/brackets/admin-auth/src\'),
        base_path(\'vendor/brackets/admin-auth/resources\'),');

        $this->call('admin-translations:scan-and-save', [
            'paths' => array_merge(config('admin-translations.scanned_directories'),
                ['vendor/brackets/admin-auth/src', 'vendor/brackets/admin-auth/resources']),
        ]);
    }
1308343
function load () {
  const str = fs.readFileSync(settingsFile, 'utf8')
  if (str) {
    const settings = JSON.parse(str)
    this.settings = settings.livereload
    this.paths = getPaths(settings)
      .map(p => path.normalize(this.root + '/' + p))
      .map(p => makeGlob(p))
  }
}
604178
function fetchTranslations() {
            var api = getApi();
            var url = api.baseUrl + api.path;
            var requestOptions;
            var queryParams = { 'source_file_name': options.sourceFile };

            if (options.exportType === 'multilingual') {
                url = url + 'translations/multilingual';
                queryParams = _.extend(queryParams, { 'file_format': 'I18NEXT_MULTILINGUAL_JSON' });
            }

            if (options.exportType === 'locale') {
                url = url + 'translations';
                queryParams = _.extend(queryParams, { 'locale': options.locale });
            }

            requestOptions = {
                method: 'GET',
                url: url,
                headers: {
                    'Content-Type': 'application/json'
                },
                qs: {
                    'api_key': api.publicKey,
                    'timestamp': api.timestamp,
                    'dev_hash': api.devHash
                }
            };

            requestOptions.qs = _.extend(requestOptions.qs, queryParams);

            return request(requestOptions, onFetchTranslations);
        }
1180799
public function indexAction()
    {
        return $this->forward()
                    ->dispatch(
                        $this->params()
                             ->fromRoute( 'controller', get_called_class() ),
                        array(
                            'action' => 'list',
                            'locale' => (string) $this->locale(),
                        )
                    );
    }
1328769
def initialize_with_i18n_routing(name, app, path, constraints, defaults = {})
      @locale = if constraints.key?(:i18n_locale)
        c = constraints.delete(:i18n_locale)
        # In rails 3.0 it's a regexp otherwise it's a string, so we need to call source on the regexp
        (c.respond_to?(:source) ? c.source : c).to_sym
      else
        nil
      end
      initialize_without_i18n_routing(name, app, path, constraints, defaults)
    end
1162202
function loadResources() {
        var resources = {};
        var resourcesDir = path.join(this.injector.rootDir, this.injector.servicesDir + '/resources');


        if (!fs.existsSync(resourcesDir)) {
            return resources;
        }

        var me = this;
        var resourceNames = fs.readdirSync(resourcesDir);

        _.each(resourceNames, function (resourceName) {
            if (resourceName.substring(resourceName.length - 3) !== '.js') {  // only dirs, not js files
                resources[resourceName] = me.injector.loadModule(utils.getCamelCase(resourceName + '.resource'));
            }
        });

        return resources;
    }
490341
private function loadRouteRules()
    {
        foreach ($this->rules['routeRules'] as $routeAlias => $routeRuleSets) {
            $resourceId = call_user_func_array($this->config['routeResourceGenerator'], [$routeAlias]);
            $this->acl->addResource(new Resource($resourceId));
            foreach ($routeRuleSets as $ruleSet) {
                $this->enforceRuleset($ruleSet, ['resources' => $resourceId, 'privileges' => $this->config['routePrivilege']]);
            }
        }
    }
971318
def get_context_data(self, **kwargs):
        

        origin_qs = self._get_query_string(self.request, False)
        context = {
            'query_string': self._get_query_string(self.request),
            'origin_qs': self.request.path + origin_qs,
            'origin_var': self.ORIGIN_ARGUMENT,
            'action_links': self.get_actions()
        }
        context.update(kwargs)

        return context
300396
public function includeRoutesFiles()
	{
		// Application Specific Module Route File Locations
		if(Config::get('sorad.api.routes.file') && is_array(Config::get('sorad.api.routes.file')))
		{
			foreach(Config::get('sorad.api.routes.file') as $route)
			{
				// Check if is an app directory and use default routes file name.
				if(is_dir(app_path($route)))
				{
					$this->loadRoutesFrom(app_path($route . '/' . $this->getRouteFileName()));
				}
				elseif(is_file(app_path($route)))
				{
					$this->loadRoutesFrom(app_path($route));
				}
			}
		}
	}
702580
protected function loadAnnotatedRoutes()
    {
        if ($this->app->environment('local') && $this->scanWhenLocal)
        {
            $this->scanRoutes();
        }

        if ( ! empty($this->scanRoutes) && $this->finder->routesAreScanned())
        {
            $this->loadScannedRoutes();
        }
    }