Mark the catalogs as initialized

@param string | array $locale
@param string | array $domain
510785
protected function markAsInitialized($locale, $domain) {
		if (is_array($locale)) {
			foreach ($locale as $part) {
				$this->markAsInitializedLocale($part, $domain);
			}
			
			return;
		}
		
		$this->markAsInitializedLocale($locale, $domain);
	}
811197
protected void init(String domain){
    // get list of public fields
    java.lang.reflect.Field[] fields = this.getClass().getDeclaredFields();
    if(fields.length > 0){
      if(domain == null)
        domain = fields[0].getDeclaringClass().getName();
      // Fix our debugging to use the child classname
      logger = Logging.getLogger(fields[0].getDeclaringClass().getName());
    }
    logger.debug("Beginning initialization from PropertyManager using domain='" + domain + "'");
    PropertyManager.ManagedProperties properties = PropertyManager.getProperties(domain);
    PropertyManager.ManagedProperties secureProperties = PropertyManager.getProperties("_" + domain);
    // Go through all the public fields in this class, and try to fill them from
    // our property class
    logger.debug("field count = " + fields.length);
    for(int i = 0; i < fields.length; i++){
      String fieldName = fields[i].getName();
      Class<?> type = fields[i].getType();
      String value = secureProperties.getProperty(fieldName);
      boolean doSecurely = value != null;
      if(value == null)
        value = properties.getProperty(fieldName);
      boolean isArray = fields[i].getType().isArray();
      try{
        if(isArray){
          if(value == null){
            // We need to grab all the values for the array (.0,.1,.2, etc)
            List<String> values = new ArrayList<String>();
            for(int j = 0; true; j++){
              if(doSecurely)
                value = secureProperties.getProperty(fieldName + "." + j);
              else
                value = properties.getProperty(fieldName + "." + j);
              if(value == null)
                break;
              if(doSecurely)
                logger.info("Setting field '" + fieldName + ":" + type.getComponentType().getName() + "' [" + j + "] to ***PROTECTED***");
              else
                logger.info("Setting field '" + fieldName + ":" + type.getComponentType().getName() + "' [" + j + "] to " + value);
              values.add(value);
            }
            if(values.size() == 0)
              continue;

            fields[i].setAccessible(true);
            fields[i].set(null, getObjectForString(type, values.toArray(new String[values.size()])));
          }else{
            // We have a single property value, try to deserialize gson
            fields[i].setAccessible(true);
            fields[i].set(null, getObjectForString(type, value));
          }
        }else if(value != null){
          if(doSecurely)
            logger.info("Setting field '" + fieldName + ":" + type.getName() + "' to ***PROTECTED***");
          else
            logger.info("Setting field '" + fieldName + ":" + type.getName() + "' to " + value);
          fields[i].setAccessible(true);
          fields[i].set(null, getObjectForString(type, value));
        }else{
          // debug.debug("'" + fieldName + "' does not exist in the properties
          // file. (Domain='" + domain + "') Leaving alone.");
        }
      }catch(Exception ex){
        logger.error("Error setting field '" + fieldName + "'. Check properties file.", ex);
      }
    }
    logger.debug("Init complete");
  }
286705
public function setLocale($locale)
    {
        if (!$this->catalogueManager->has($locale)) {
            throw new LocaleException($locale);
        }

        $this->locale = $locale;
        $this->catalogueManager->load($locale);

        return $this;
    }
988172
protected function getSingleCatalog($locale, $domain = null) {
		if (! isset($this->catalogs[$locale])) {
				 return [];
		}

		if ($domain === null) {
			return [$locale => $this->catalogs[$locale]];
		}

		if (is_string($domain)) {
			if (! isset($this->catalogs[$locale][$domain])) {
				return [];
			}

			return [
				$locale => [
					$domain => $this->catalogs[$locale][$domain]
				]
			];
		}

		if (is_array($domain)) {
			return [$locale => array_intersect_key(
				$this->catalogs[$locale],
				array_flip($domain))
			];
		}
		
		throw new InvalidParameter('Domain must be a string or an array');
	}
46038
public void setLocale(final Locale locale) {
        if (!equals(this.locale, locale)) {
            this.locale = locale;
            super.setValue(toString(locale));
            i18nBundleProvider.reloadBundles(locale);
        }
    }
1229962
public function createDomainAction(Domain $domain)
    {
        $this->domainRepository->add($domain);
        $this->addFlashMessage('The domain "%s" has been created.', 'Domain created', Message::SEVERITY_OK, [htmlspecialchars($domain)], 1412373192);
        $this->unsetLastVisitedNodeAndRedirect('edit', null, null, ['site' => $domain->getSite()]);
    }
1085719
public static function add(array $translates, string $locale = null) : void
    {
        $locale = ($locale === null) ? I18n::$locale : $locale;

        if (isset(I18n::$dictionary[$locale])) {
            I18n::$dictionary[$locale] += $translates;
        } else {
            I18n::$dictionary[$locale] = $translates;
        }
    }
848863
protected function handlePreinit($locale, $domain) {
		if (! empty($this->preinitLocales)) {
			$locale = array_unique(array_merge(
				(array) $locale, 
				$this->preinitLocales
			));
		}

		if (! empty($this->preinitDomains)) {
			$domain = array_unique(array_merge(
				(array) $domain,
				$this->preinitDomains
			));
		}
		
		$this->preinitNeed = false;
		
		return [$locale, $domain];
	}
4402
public function translator(string $locale, string $domain, string $directory): ?TranslatorInterface
    {
        $class = GETTEXT_EXTENSION ? GettextTranslator::class : Translator::class;

        $previous = self::$translator;
        self::$translator = new $class($locale, $domain, $directory);

        if ($previous === null) {
            require __DIR__ . DIRECTORY_SEPARATOR . 'helpers.php';
        }

        $this->locale = $locale;

        return $previous;
    }
324411
protected function getValue($string, $domain, $locale)
    {
        if (!$domain) {
            $domain = 'default';
        }

        $this->loadDomain($domain, $locale);

        // We have to treat 'languages', 'default', 'modules' etc. domains differently.
        if (!(isset($GLOBALS['TL_LANG'][$domain]) && is_array($GLOBALS['TL_LANG'][$domain]))
            && (substr($domain, 0, 2) != 'tl_')
        ) {
            $lang = $GLOBALS['TL_LANG'];
        } else {
            if (!is_array($GLOBALS['TL_LANG'][$domain])) {
                return $string;
            }
            $lang = $GLOBALS['TL_LANG'][$domain];
        }

        $chunks = explode('.', $string);

        while (($chunk = array_shift($chunks)) !== null) {
            if (!array_key_exists($chunk, $lang)) {
                return $string;
            }

            $lang = $lang[$chunk];
        }

        return $lang;
    }
775895
public function setDomain(?string $domain) : void
    {
        $this->domain = (($domain === null) ? null : strtolower($domain));
    }
1102993
public function build($locale, $domain = 'gui')
    {
        $cache = new ConfigCache($this->cacheDir.'/translations-'.$locale.'.js', $this->debug);

        if (!$cache->isFresh()) {
            $content = $this->buildContent($locale, $domain);

            $cache->write($content->getContent(), $content->getResources());

            if (!$this->debug) {
                $this->compressor->compressFile((string) $cache);
            }
        }

        return new Asset((string) $cache);
    }
444495
public function setMsgs( $messagesByKey, $domain = null, $lang = null ) {
		foreach ( $messagesByKey as $key => $message ) {
			$this->setMsg( $key, $message, $domain, $lang );
		}
	}
344787
public function findAllNotDisabled($locale, $domain = null)
    {
        $qb = $this->createQueryBuilder('t');
        $qb
            ->select('t')
            ->where('t.locale = :locale')
            ->andWhere('t.status != :statusstring')
            ->setParameter('statusstring', Translation::STATUS_DISABLED)
            ->setParameter('locale', $locale);
        if (!\is_null($domain) && !empty($domain)) {
            $qb->andWhere('t.domain = :tdomain')
                ->setParameter('tdomain', $domain);
        }

        return $qb->getQuery()->getResult();
    }
460503
public function getAllByLocaleAndDomain($locale, $domain)
    {
        $results = $this->createQueryBuilder()
            ->hydrate(false)
            ->field('domain')->equals($domain)
            ->field('translations.locale')->equals($locale)
            ->sort('key', 'asc')
            ->getQuery()
            ->execute();

        $values = array();
        foreach ($results as $item) {
            $i = 0;
            $index = null;
            while ($i < $item['translations'] && null === $index) {
                if ($item['translations'][$i]['locale'] == $locale) {
                    $index = $i;
                }
                $i++;
            }
            $item['translations'] = array($item['translations'][$i - 1]);
            $values[] = $item;
        }

        return $values;
    }
1156606
public function load($locale)
    {
        if ($this->isLoaded($locale)) {
            return;
        }
        $this->languages[$locale] = $this->handler->load($locale);
    }
867715
public void setLocale(Locale locale) {
		if (!initialized) {
			super.setLocale(locale);
		} else {
			this.locale = locale;
			super.setLocale(locale);
			init();
		}
	}