Adds translation domain (usually it's the same as name of .po file [without extension])

Encoding must be set before calling addDomain!
344496
public function addDomain($domain, $path='./locale/')
    {
        bindtextdomain($domain, $path);
        if ($this->_encoding) {
            bind_textdomain_codeset($domain, $this->_encoding);
        }
        $this->useDomain($domain);
    }
35470
public function add_texts($dir, $add2client = false)
    {
        $domain = $this->ID;
        $lang   = $_SESSION['language'];
        $langs  = array_unique(array('en_US', $lang));
        $locdir = slashify(realpath(slashify($this->home) . $dir));
        $texts  = array();

        // Language aliases used to find localization in similar lang, see below
        $aliases = array(
            'de_CH' => 'de_DE',
            'es_AR' => 'es_ES',
            'fa_AF' => 'fa_IR',
            'nl_BE' => 'nl_NL',
            'pt_BR' => 'pt_PT',
            'zh_CN' => 'zh_TW',
        );

        // use buffering to handle empty lines/spaces after closing PHP tag
        ob_start();

        foreach ($langs as $lng) {
            $fpath = $locdir . $lng . '.inc';
            if (is_file($fpath) && is_readable($fpath)) {
                include $fpath;
                $texts = (array)$labels + (array)$messages + (array)$texts;
            }
            else if ($lng != 'en_US') {
                // Find localization in similar language (#1488401)
                $alias = null;
                if (!empty($aliases[$lng])) {
                    $alias = $aliases[$lng];
                }
                else if ($key = array_search($lng, $aliases)) {
                    $alias = $key;
                }

                if (!empty($alias)) {
                    $fpath = $locdir . $alias . '.inc';
                    if (is_file($fpath) && is_readable($fpath)) {
                        include $fpath;
                        $texts = (array)$labels + (array)$messages + (array)$texts;
                    }
                }
            }
        }

        ob_end_clean();

        // prepend domain to text keys and add to the application texts repository
        if (!empty($texts)) {
            $add = array();
            foreach ($texts as $key => $value) {
                $add[$domain.'.'.$key] = $value;
            }

            $rcube = rcube::get_instance();
            $rcube->load_language($lang, $add);

            // add labels to client
            if ($add2client && method_exists($rcube->output, 'add_label')) {
                if (is_array($add2client)) {
                    $js_labels = array_map(array($this, 'label_map_callback'), $add2client);
                }
                else {
                    $js_labels = array_keys($add);
                }
                $rcube->output->add_label($js_labels);
            }
        }
    }
883126
function (domain, poString, verbose) {
        if (typeof verbose === 'undefined') {
            verbose = false;
        }

        var normalizedDomain = gt._normalizeDomain(domain);
        gt.addTextdomain(domain, poString);
        var poDomain = gt.domains[normalizedDomain];
        var language = poDomain.headers.language;
        var options = {};

        if (language && domain != language && verbose) {
            process.stdout.write('domain specified does not match language specified in po file.\n');
        }

        var icuObject = {};
        var self = this;
        Object.keys(poDomain['translations']['']).forEach(function (key) {
            var msg = poDomain['translations'][''][key];
            if (msg.msgid.length > 0) {
                var icuMsg = null;
                if (msg.comments !== undefined) {
                    options.poFormat = msg.comments.flag;
                }
                if (msg.msgid_plural !== undefined) {
                    try {
                        icuMsg = self.pluralMsgToICU(msg, domain, options);
                    } catch (err) {
                        // msg is undefined or cannot have regex used against it.
                        if (verbose) {
                            process.stdout.write('Warning: undefined msg encountered for ' + domain + '\n');
                        }
                        icuMsg = '';
                    }
                } else {
                    try {
                        icuMsg = self.msgToICU(msg, options);
                    } catch (err) {
                        // msg is undefined or cannot have regex used against it.
                        if (verbose) {
                            process.stdout.write('Warning: undefined msg encountered for ' + domain + '\n');
                        }
                        icuMsg = '';
                    }
                }
                icuObject[icuMsg['icuId']] = icuMsg['icuStr'];
            }
        });
        return icuObject;
    }
1226407
public function load_textdomain() {
		if ( null !== $this->get_path() ) {
			load_textdomain( $this->textdomain, $this->get_path() );
		}
		load_plugin_textdomain( $this->textdomain, false, dirname( KIRKI_PLUGIN_FILE ) . '/languages' );
	}
1253993
function createTranslatorURL(sourceLang, targetLang, sourceText) {
  return url.format({
    protocol: 'https:',
    hostname: 'translate.googleapis.com',
    pathname: '/translate_a/single',
    query: {
      client: 'gtx',
      ie: 'UTF-8',
      oe: 'UTF-8',
      sl: sourceLang,
      tl: targetLang,
      dt: 't',
      // dj: 1, // For more detailed JSON response
      q: sourceText,
    }
  });
}
1151590
protected function load_textdomain() {
        $domain = $this->options->domain;

        if ( empty( $domain ) ) {
            return;
        }

        $path = $this->options->lang_path;

        if ( empty( $path ) ) {
            $path = $this->get_path( $this->options->lang_dir );
        }

        $path = sprintf( '%s/%s-%s.mo', rtrim( $path, '/' ), $domain, get_locale() );

        load_textdomain( $domain, $path );
    }
996538
public void addRequestedLocalization(final Object node, final String key, final String domain, final String locale, final Localization localization) {

		final GenericProperty keyKey    = new GenericProperty("key");
		final GenericProperty domainKey = new GenericProperty("domain");
		final GenericProperty localeKey = new GenericProperty("locale");
		final GenericProperty nodeKey   = new GenericProperty("node");

		boolean notContained = true;
		for (GraphObject gom : localizations) {
			if (notContained) {

				if (gom.getProperty(keyKey).equals(key) && gom.getProperty(domainKey).equals(domain) && gom.getProperty(localeKey).equals(locale)) {

					final GraphObject prevNode = (GraphObject)gom.getProperty(nodeKey);
					if (prevNode != null && node != null && prevNode.getUuid().equals(((GraphObject)node).getUuid())) {
						notContained = false;
					}
				}
			}
		}

		if (notContained) {

			final Map<String, Object> data = new HashMap();
			data.put("node", node);
			data.put("key", key);
			data.put("domain", domain);
			data.put("locale", locale);
			data.put("localization", localization);

			GraphObjectMap converted = GraphObjectMap.fromMap(data);

			if (!localizations.contains(converted)) {
				localizations.add(converted);
			}
		}
	}
771730
function (request, response) {
      var locale = request.params.locale;
      var sendFile = response.sendFile || response.sendfile;
      sendFile.apply(response, [path.join(configuration.directory, locale + configuration.extension)]);
    }
921399
def update(domain):
    
    translations_dir = _get_translations_dir()
    domain = _get_translations_domain(domain)
    pot = os.path.join(translations_dir, f'{domain}.pot')
    return _run(f'update -i {pot} -d {translations_dir} --domain={domain}')
743214
function addPointToDomain( point, x, y, domainId ){

        var domain = domains[ domainId ];
        var newPoint = {
            value: point,
            x: x,
            y: y,
            identifier: domain.identifier,
            domainId: domainId
        };

        pointsHash[ x + '_' + y ] = {
            value: point,
            identifier: domain.identifier,
            domainId: domainId
        };

        domain.points.push( newPoint );
    }
916652
function setDomain(domain) {
    checkIsObject('domain', domain);
    checkIsString('doamin.name', domain.name);
    //test domain, domain.name
    domainsMap = domainsMap.set(domain.name, domain);
}
1027450
def install_translations(config):
    """"""

    if not config:
        return

    from . import _translation
    checks_translation = gettext.translation(domain=config["domain"],
                                             localedir=internal.check_dir / config["localedir"],
                                             fallback=True)
    _translation.add_fallback(checks_translation)
999234
protected function addTranslations(array $translations)
    {
        $domain = $translations['domain'] ?? '';

        //Set the first domain loaded as default domain
        if ($this->domain === null) {
            $this->domain = $domain;
        }

        if (isset($this->dictionary[$domain])) {
            $this->dictionary[$domain] = \array_replace_recursive($this->dictionary[$domain], $translations['messages']);

            return;
        }

        if (!empty($translations['plural-forms'])) {
            [$count, $code] = \array_map('trim', \explode(';', $translations['plural-forms'], 2));

            // extract just the expression turn 'n' into a php variable '$n'.
            // Slap on a return keyword and semicolon at the end.
            $this->plurals[$domain] = [
                'count' => (int) \str_replace('nplurals=', '', $count),
                'code' => \str_replace('plural=', 'return ', \str_replace('n', '$n', $code)).';',
            ];
        }

        $this->dictionary[$domain] = $translations['messages'];
    }
1169040
function registerCompression(encodingName, fileExtension) {
        if (!findCompressionByName(encodingName))
            compressions.push(new Compression(encodingName, fileExtension));
    }
1122460
def import_domain(self, domain_data):
        
        uri = "/domains/import"
        body = {"domains": [{
                "contentType": "BIND_9",
                "contents": domain_data,
                }]}
        resp, resp_body = self._async_call(uri, method="POST", body=body,
                error_class=exc.DomainCreationFailed)
        return resp_body
210771
def set(self, id, translation, domain='messages'):
        
        assert isinstance(id, (str, unicode))
        assert isinstance(translation, (str, unicode))
        assert isinstance(domain, (str, unicode))

        self.add({id: translation}, domain)
1337235
private function handleLocalizationCommon()
    {
        $this->handleLanguageIntoSession();
        $localizationFile = $this->getCommonLocaleFolder() . '/locale/'
            . $this->tCmnSession->get('lang') . '/LC_MESSAGES/'
            . $this->commonLibFlags['localization_domain'] . '.mo';
        $translations     = new \Gettext\Translations();
        $translations->addFromMoFile($localizationFile);
        $this->tCmnLb     = new \Gettext\Translator();
        $this->tCmnLb->loadTranslations($translations);
    }