@param string $fileFullPath
@param string $localeDir
@param string $messageFile

@return ResourceBundleInterface
8396
protected function loadBundleFromFile(
        string $fileFullPath,
        string $localeDir,
        string $messageFile
    ): ResourceBundleInterface {
        /** @noinspection PhpIncludeInspection */
        $properties = require $fileFullPath;
        $bundle     = new ResourceBundle($localeDir, $messageFile, $properties);

        return $bundle;
    }
1162995
public function importFile($localPath, FileInterface $folder = null)
    {
        if(!$folder->isDir()){
            throw new RuntimeException('Files can only be moved into directories');
        }
        //$fileName = $uploadedFile->getClientOriginalName();

        $fileName = basename($localPath);

        $targetPath = $folder ? $folder->getPath() . "$fileName" : $fileName;

        $this->files->move($localPath, $targetPath);

        $absPath = $this->mapper->absolutePath($targetPath);

        $file = $this->createFromPath($targetPath);

        if ($folder) {
            $file->setDir($folder);
            $folder->addChild($file);
        }

        $this->save($file);

        return $file;
    }
1068165
public function addTranslation($localPath, $crowdinPath, $exportPattern = null, $title = null)
    {
        $translation = new Translation($localPath, $crowdinPath);
        $translation->setExportPattern($exportPattern);
        $translation->setTitle($title);

        $this->translations[] = $translation;

        return $this;
    }
357903
private function loadLangFile($fullPath)
    {
        //====================================================================//
        // Check if File Exists
        if (!is_file($fullPath)) {
            return false;
        }

        //====================================================================//
        // Open File
        $file = @fopen($fullPath, "rt");
        if (!$file) {
            return false;
        }

        //====================================================================//
        // Import All New Translation Keys
        // Ex: Need 225ms for all fgets on all lang file for Third party page. Same speed than file_get_contents
        while ($line = fgets($file, 4096)) {
            $this->loadLangLine($line);
        }

        //====================================================================//
        // Close File
        fclose($file);
    }
742036
public static List<String> getAvailableLocaleSuffixesForBundle(String messageBundlePath,
			ServletContext servletContext) {

		return getAvailableLocaleSuffixesForBundle(messageBundlePath, MSG_RESOURCE_BUNDLE_SUFFIX, servletContext);
	}
1182021
public static function imageEncode($fileFullPath)
    {
        $type = pathinfo($fileFullPath, PATHINFO_EXTENSION);
        $data = file_get_contents($fileFullPath);
        return $base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);
    }
165662
private function getLocalXliffFile(TranslationResource $resource, $languageCode)
    {
        $domain    = substr($resource->getSlug(), strlen($this->prefix));
        $localFile = $this->txlang . DIRECTORY_SEPARATOR .
            substr($languageCode, 0, 2) . DIRECTORY_SEPARATOR .
            $domain . '.xlf';

        $local = new XliffFile($localFile);
        if (!file_exists($localFile)) {
            // Set base values.
            $local->setDataType('php');
            $local->setOriginal($domain);
            $local->setSrcLang($this->baselanguage);
            $local->setTgtLang(substr($languageCode, 0, 2));
        }

        return $local;
    }
1207053
private String messageImportCantReadResource(Locale locale, String path) {

        return Messages.get().getBundle(locale).key(Messages.ERR_ALIAS_IMPORT_COULD_NOT_READ_RESOURCE_0);

    }
677374
@Override
    protected void setMessageResourceBundle(HttpServletRequest request, ResourceBundle bundle)
	{
		Config.set(request, Config.FMT_LOCALIZATION_CONTEXT, new LocalizationContext(bundle, request.getLocale()));
        LOGGER.debug("Enabled JSTL localization using: ", bundle);
        LOGGER.debug("Loaded resource bundle ", bundle, " as default bundle");
    }
1335468
protected ResourceBundle resourceBundle(Locale locale) {
        return ResourceBundle.getBundle(
            contentPath.replace('/', '.') + ".l10n", locale,
            contentLoader, ResourceBundle.Control.getNoFallbackControl(
                ResourceBundle.Control.FORMAT_DEFAULT));
    }
537285
protected function findOrCreateRoute($path, $locale, CustomUrlBehavior $document, $route)
    {
        try {
            /** @var RouteDocument $routeDocument */
            $routeDocument = $this->documentManager->find($path, $locale);
        } catch (DocumentNotFoundException $ex) {
            return $this->documentManager->create('custom_url_route');
        }

        if (!$routeDocument instanceof RouteDocument
            || $routeDocument->getTargetDocument()->getUuid() !== $document->getUuid()
        ) {
            throw new ResourceLocatorAlreadyExistsException($route, $document->getTitle());
        }

        return $routeDocument;
    }
39689
@Override
    protected VoltMessage instantiate_local(byte messageType)
    {
        // instantiate a new message instance according to the id
        VoltMessage message = null;

        switch (messageType) {
        case INITIATE_TASK_ID:
            message = new InitiateTaskMessage();
            break;
        case INITIATE_RESPONSE_ID:
            message = new InitiateResponseMessage();
            break;
        case FRAGMENT_TASK_ID:
            message = new FragmentTaskMessage();
            break;
        case FRAGMENT_RESPONSE_ID:
            message = new FragmentResponseMessage();
            break;
        case PARTICIPANT_NOTICE_ID:
            message = new MultiPartitionParticipantMessage();
            break;
        case COALESCED_HEARTBEAT_ID:
            message = new CoalescedHeartbeatMessage();
            break;
        case COMPLETE_TRANSACTION_ID:
            message = new CompleteTransactionMessage();
            break;
        case COMPLETE_TRANSACTION_RESPONSE_ID:
            message = new CompleteTransactionResponseMessage();
            break;
        case IV2_INITIATE_TASK_ID:
            message = new Iv2InitiateTaskMessage();
            break;
        case IV2_REPAIR_LOG_REQUEST:
            message = new Iv2RepairLogRequestMessage();
            break;
        case IV2_REPAIR_LOG_RESPONSE:
            message = new Iv2RepairLogResponseMessage();
            break;
        case REJOIN_RESPONSE_ID:
            message = new RejoinMessage();
            break;
        case REJOIN_DATA_ID:
            message = new RejoinDataMessage();
            break;
        case REJOIN_DATA_ACK_ID:
            message = new RejoinDataAckMessage();
            break;
        case FRAGMENT_TASK_LOG_ID:
            message = new FragmentTaskLogMessage();
            break;
        case IV2_LOG_FAULT_ID:
            message = new Iv2LogFaultMessage();
            break;
        case IV2_EOL_ID:
            message = new Iv2EndOfLogMessage();
            break;
        case DUMP:
            message = new DumpMessage();
            break;
        case MP_REPLAY_ID:
            message = new MpReplayMessage();
            break;
        case MP_REPLAY_ACK_ID:
            message = new MpReplayAckMessage();
            break;
        case SNAPSHOT_CHECK_REQUEST_ID:
            message = new SnapshotCheckRequestMessage();
            break;
        case SNAPSHOT_CHECK_RESPONSE_ID:
            message = new SnapshotCheckResponseMessage();
            break;
        case IV2_REPAIR_LOG_TRUNCATION:
            message = new RepairLogTruncationMessage();
            break;
        case DR2_MULTIPART_TASK_ID:
            message = new Dr2MultipartTaskMessage();
            break;
        case DR2_MULTIPART_RESPONSE_ID:
            message = new Dr2MultipartResponseMessage();
            break;
        case DUMMY_TRANSACTION_TASK_ID:
            message = new DummyTransactionTaskMessage();
            break;
        case DUMMY_TRANSACTION_RESPONSE_ID:
            message = new DummyTransactionResponseMessage();
            break;
        case Migrate_Partition_Leader_MESSAGE_ID:
            message = new MigratePartitionLeaderMessage();
            break;
        case DUMP_PLAN_ID:
            message = new DumpPlanThenExitMessage();
            break;
        case FLUSH_RO_TXN_MESSAGE_ID:
            message = new MPBacklogFlushMessage();
            break;
        default:
            message = null;
        }
        return message;
    }
726411
protected function importBundleTranslationFiles(BundleInterface $bundle, $locales, $domains, $global = false)
    {
        $path = $bundle->getPath();
        if ($global) {
            $path = $this->getApplication()->getKernel()->getRootDir() . '/Resources/' . $bundle->getName() . '/translations';
            $this->output->writeln('<info>*** Importing ' . $bundle->getName() . '`s translation files from ' . $path . ' ***</info>');
        }

        $this->output->writeln(sprintf('<info># %s:</info>', $bundle->getName()));
        $finder = $this->findTranslationsFiles($path, $locales, $domains);
        $this->importTranslationFiles($finder);
    }
578246
private function encodeMergedBundles(
        ResourceBundleInterface $localizedBundle,
        ResourceBundleInterface $defaultBundle = null
    ): array {
        if ($defaultBundle === null) {
            // there is no default bundle for this localized one
            return $this->encodeBundle($localizedBundle);
        }

        $localizedKeys = $localizedBundle->getKeys();
        $defaultKeys   = $defaultBundle->getKeys();

        $commonKeys        = array_intersect($localizedKeys, $defaultKeys);
        $localizedOnlyKeys = array_diff($localizedKeys, $commonKeys);
        $defaultOnlyKeys   = array_diff($defaultKeys, $commonKeys);

        $encodedBundle = [];

        foreach ($commonKeys as $key) {
            $encodedBundle[$key] = $this->getBundleValue($localizedBundle, (string)$key);
        }
        foreach ($localizedOnlyKeys as $key) {
            $encodedBundle[$key] = $this->getBundleValue($localizedBundle, (string)$key);
        }
        foreach ($defaultOnlyKeys as $key) {
            $encodedBundle[$key] = $this->getBundleValue($defaultBundle, (string)$key);
        }

        return $encodedBundle;
    }
455824
private function createBundleFile ($minifier, $fileName, $files, $sitePath, $bundleDir, $cleanCode = true)
    {
        $translator = $this->getServiceLocator()->get('translator');
        $message = '';
        $success = false;
        if (!empty($files)) {
            try {
                foreach ($files as $key => $file) {
                    //remove comments
                    if($cleanCode) {
                        $codeToAdd = $this->removeComments($sitePath . $file);
                    }else{
                        $codeToAdd = $sitePath . $file;
                    }
                    //add the file to minify later
                    $minifier->add($codeToAdd);
//                 $minifier = $this->getFileContentsViaCurl($minifier, $file);
                }
                //minify all the files
                $minifier->minify($bundleDir . $fileName);
                $message = $translator->translate('tr_front_minify_assets_compiled_successfully');
                $success = true;
            } catch (\Exception $ex) {
                /**
                 * this will occur only if the bundle.css or bundle.js
                 * is not writable or no permission or other errors
                 */
                  $message = wordwrap($ex->getMessage(), 20, "\n", true);
            }
        }else{
            $success = true;
        }

        return array(
            'message' => $message,
            'success' => $success
        );
    }
982207
public function parseDirectory($packageHandle, $packageVersion, $path, $relDirectory = '', $searchDictionaryFiles = self::DICTIONARY_ALL)
    {
        if (!$this->filesystem->isDirectory($path)) {
            throw new UserMessageException(t('Unable to find the directory %s', $path));
        }
        if ('' === (string) $relDirectory && '' !== (string) $packageHandle) {
            switch ($packageHandle) {
                case 'concrete5':
                    $relDirectory = 'concrete';
                    break;
                default:
                    $relDirectory = 'packages/' . $packageHandle;
                    break;
            }
        }
        $result = null;
        $pot = new Translations();
        $pot->setLanguage($this->app->make('community_translation/sourceLocale'));
        C5TLParser::clearCache();
        $m = null;
        if (preg_match('/^' . preg_quote(Version::DEV_PREFIX, '/') . '(\d+(?:\.\d+)*)/', $packageVersion, $m)) {
            $checkVersion = $m[1] . '.99.99';
        } else {
            $checkVersion = $packageVersion;
        }
        foreach (C5TLParser::getAllParsers() as $parser) {
            /* @var C5TLParser $parser */
            if ($parser->canParseDirectory()) {
                if ($packageHandle !== 'concrete5' || $parser->canParseConcreteVersion($checkVersion)) {
                    $parser->parseDirectory($path, $relDirectory, $pot);
                }
            }
        }
        if (count($pot) > 0) {
            $result = new Parsed();
            $result->setSourceStrings($pot);
        }
        if ($searchDictionaryFiles !== self::DICTIONARY_NONE) {
            foreach ($this->filesystem->allFiles($path) as $file) {
                $kind = self::DICTIONARY_NONE;
                switch (strtolower($file->getExtension())) {
                    case 'pot':
                        if ($searchDictionaryFiles & self::DICTIONARY_SOURCE) {
                            $kind = self::DICTIONARY_SOURCE;
                        }
                        break;
                    case 'po':
                        if ($searchDictionaryFiles & self::DICTIONARY_LOCALIZED_SOURCE) {
                            $kind = self::DICTIONARY_LOCALIZED_SOURCE;
                        }
                        break;
                    case 'mo':
                        if ($searchDictionaryFiles & self::DICTIONARY_LOCALIZED_COMPILED) {
                            $kind = self::DICTIONARY_LOCALIZED_COMPILED;
                        }
                        break;
                }
                if ($kind === self::DICTIONARY_NONE) {
                    continue;
                }
                $parsed = $this->parseDictionaryFile($packageHandle, $packageVersion, $file->getPathname(), $kind);
                if ($parsed !== null) {
                    if ($result === null) {
                        $result = $parsed;
                    } else {
                        $result->mergeWith($parsed);
                    }
                }
            }
        }

        return $result;
    }
984536
public static ResourceBundle getResourceBundle(String bundleName, Locale locale)
    {
        return ResourceBundle.getBundle(bundleName, locale);
    }