for admin translations
545672
def tra(label, desc = "", tokens = {}, options = {})
      if Tr8n::Config.enable_admin_translations?
        if Tr8n::Config.enable_admin_inline_mode?
          tr(label, desc, tokens, options)
        else
          trl(label, desc, tokens, options)
        end
      else
        Tr8n::Config.default_language.translate(label, desc, tokens, options)
      end
    end
591576
public function registerTranslations() {
		$i18n = \Yii::$app->i18n;
		if($this->messagesPath && $this->messageCategory && !isset($i18n->translations[$this->messageCategory])) {
			$i18n->translations[$this->messageCategory] = [
				'class' => 'yii\i18n\PhpMessageSource',
				'basePath' => $this->messagesPath,
				'sourceLanguage' => \Yii::$app->sourceLanguage,
			];
		}
	}
316321
def validate_language_management
      # admins can do everything
      return if tr8n_current_user_is_admin?
    
      if tr8n_current_language.default?
        trfe("Only administrators can modify this language")
        return redirect_to(tr8n_features_tabs.first[:link])
      end

      unless tr8n_current_user_is_translator? and tr8n_current_translator.manager? 
        trfe("In order to manage a language you first must request to become a manager of that language.")
        return redirect_to(tr8n_features_tabs.first[:link])
      end
    end
1097832
protected function initTranslations()
    {
        /** @var \yii\i18n\I18N $i18n */
        $i18n = Instance::ensure($this->i18n, \yii\i18n\I18N::class);
        $i18n->translations['recaptcha*'] = [
            'class' => PhpMessageSource::class,
            'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'messages',
            'sourceLanguage' => 'en',
            'fileMap' => [
                'recaptcha' => 'recaptcha.php',
            ],
        ];
    }
431131
def translations_link(self):
        
        translation_type = ContentType.objects.get_for_model(Translation)
        link = urlresolvers.reverse('admin:%s_%s_changelist' % (
            translation_type.app_label,
            translation_type.model),
        )

        object_type = ContentType.objects.get_for_model(self)
        link += '?content_type__id__exact=%s&object_id=%s' % (object_type.id, self.id)
        return '<a href="%s">translate</a>' % link
475265
public function adminRender()
    {
        global $locale;

        $xml = new DOMDocument('1.0', 'UTF-8');
        $xml->load(Eresus_CMS::getLegacyKernel()->froot . 'core/about.xml');

        $data = array();

        /* @var DOMElement $product */
        $product = $xml->getElementsByTagName('product')->item(0);
        $data['product'] = array();
        $data['product']['title'] = $product->getAttribute('title');
        $data['product']['version'] = $product->getAttribute('version');

        $data['product']['copyrights'] = array();
        $copyrights = $product->getElementsByTagName('copyright');
        for ($i = 0; $i < $copyrights->length; $i++)
        {
            /* @var DOMElement $copyright */
            $copyright = $copyrights->item($i);
            $data['product']['copyrights'] []= array(
                'year' => $copyright->getAttribute('year'),
                'owner' => $copyright->getAttribute('owner'),
                'url' => $copyright->getAttribute('url'),
            );
        }

        $license = $xml->getElementsByTagName('license')->item(0);
        $data['license'] = array();
        $data['license']['text'] = $license->getElementsByTagName($locale['lang'])->item(0)->textContent;

        /** @var TAdminUI $page */
        $page = Eresus_Kernel::app()->getPage();
        $tmpl = $page->getUITheme()->getTemplate('misc/about.html');
        $html = $tmpl->compile($data);

        return $html;
    }
1281732
public function actionUpdateAll()
    {
        
        // Scan the locales folder for languages in the wwextension and
        // launch actionUpdate for each of them.

    	// Get the list of languages that will be updated.
		$locales = $this->getLanguageList();

		// We now identified locales to be updated.
    	$this->outVerbose("Languages '" . implode(',', $locales) . "' will be updated for extension '" . $this->options['extension'] . "'.");
    	foreach ($locales as $l) {
    		$this->options['language'] = $l;
    		$this->checkUpdateInput();
    		$this->actionUpdate();
    		
    		$this->outVerbose("");
    	}
        
    }
685587
public function loadTranslations()
    {
        $directory = $this->getDirectory().'/../../resources/lang';

        $this->loadTranslationsFrom($directory, 'amethyst-'.$this->getPackageName());

        $this->publishes([
            $directory => resource_path('lang/vendor/amethyst'),
        ], 'resources');
    }
865143
private function LoadBackendTranslations()
    {
        $backendUser = BackendModule::Guard()->GetUser();
        if ($backendUser)
        {
            $backendLanguage = $backendUser->GetLanguage()->GetCode();
            $backendTranslations = PathUtil::BackendBundleTranslationFile($this->BundleName(), $backendLanguage);
            if (File::Exists($backendTranslations))
            {
                require_once $backendTranslations;
            }
        }
    }
52921
function translate(key, options, hasOwnOptions) {

			var lng = options.lng || 'auto';

			if (!translations[lng]) {
				translations[lng] = {};
			}

			if (!t) {

				translations[lng][key] = 'defaultLoadingValue' in options ? options.defaultLoadingValue :
					'defaultValue' in options ? options.defaultValue :
					'defaultLoadingValue' in globalOptions ? globalOptions.defaultLoadingValue : key;

			} else if (!translations[lng][key] || hasOwnOptions) {

				translations[lng][key] = t(key, options);

			}

		}
317118
public function admin_assets() {

		wp_enqueue_script(
			'pods-admin-i18n',
			PODS_URL . 'components/I18n/pods-admin-i18n.js',
			array(
				'jquery',
				'pods-i18n',
			),
			'1.0',
			true
		);
		$localize_script = array();
		if ( ! empty( $this->languages ) ) {
			foreach ( $this->languages as $lang => $lang_data ) {
				$lang_label = $this->create_lang_label( $lang_data );
				if ( ! empty( $lang_label ) ) {
					$lang_label = $lang . ' (' . $lang_label . ')';
				} else {
					$lang_label = $lang;
				}
				$localize_script[ $lang ] = $lang_label;
			}
		}
		wp_localize_script( 'pods-admin-i18n', 'pods_admin_i18n_strings', $localize_script );

		// Add strings to the i18n js object
		add_filter( 'pods_localized_strings', array( $this, 'localize_assets' ) );
	}
228150
function translateUiTitles (elements) {
  if (elements.title && typeof elements.title == 'string') {
    elements.title = flattenTitles(elements.title)
  }
  if (elements.elements) {
    translateUiTitles(elements.elements)
  }
  for (section in elements) {
    if (elements[section].ui) {
      var sectionTitle = elements[section].ui.title
      elements[section].ui.title = flattenTitles(sectionTitle)
    }
    if (elements[section].components) {
      translateUiTitles(elements[section].components.elements)
    }
  }
  return elements
}
633366
protected function setTranslations() {
        if( $this->getAttribute('cache_time') ) {
            $translations = Cache::remember('users', $this->getAttribute('cache_time'), function() {
                $translations = $this->getRepository()
                    ->allTranslations()
                    ->toArray();

                return $this->prepareTranslations(
                    $translations
                );
            });
        } else {
            $translations = $this->getRepository()
                ->allTranslations()
                ->toArray();

            $translations = $this->prepareTranslations(
                $translations
            );
        }

        $this->translations = $translations;

        return $this;
    }
541187
def translations(context: Context, pull=False, push=False):
    
    if not (pull or push):
        raise TaskError('Specify whether to push or pull translations')
    if pull:
        context.shell('tx', 'pull')
        make_messages(context, javascript=False)
        make_messages(context, javascript=True)
    if push:
        context.shell('tx', 'push', '--source', '--no-interactive')
30772
def convert_translations(self, dest_dir):
        
        if not os.path.isdir(dest_dir):
            os.makedirs(dest_dir)
        total_translation_rows = 0
        with open(os.path.join(dest_dir, 'translations.txt'),
                  'w+b') as out_file:
            writer = csv.DictWriter(
                out_file, fieldnames=NEW_TRANSLATIONS_FIELDS)
            writer.writeheader()
            for filename in sorted(os.listdir(self.src_dir)):
                if not (filename.endswith('.txt') and
                        os.path.isfile(os.path.join(self.src_dir, filename))):
                    print('Skipping %s' % filename)
                    continue
                table_name = filename[:-len('.txt')]
                if table_name == 'translations':
                    continue
                total_translation_rows += self._translate_table(
                    dest_dir, table_name, writer)
        print('Total translation rows: %s' % total_translation_rows)
1296919
public function index()
    {
        $this->loadModel('System.Options');
        $languages = LocaleToolbox::languagesList();
        $arrayContext = [
            'schema' => [
                'site_title' => 'string',
                'site_slogan' => 'string',
                'site_description' => 'string',
                'site_email' => 'string',
                'site_contents_home' => 'integer',

                'site_maintenance' => 'boolean',
                'site_maintenance_ip' => 'string',
                'site_maintenance_message' => 'string',

                'default_language' => 'string',
                'url_locale_prefix' => 'string',
            ],
            'defaults' => [],
            'errors' => [],
        ];
        $variables = $this->Options
            ->find()
            ->where(['name IN' => array_keys($arrayContext['schema'])])
            ->all();

        foreach ($variables as $var) {
            $arrayContext['defaults'][$var->name] = $var->value;
        }

        if ($this->request->data()) {
            $validator = $this->_mockValidator();
            $errors = $validator->errors($this->request->data());

            if (empty($errors)) {
                foreach ($this->request->data() as $k => $v) {
                    $this->Options->update($k, $v, null, false);
                }
                snapshot();
                $this->Flash->success(__d('system', 'Configuration successfully saved!'));
                $this->redirect($this->referer());
            } else {
                $arrayContext['errors'] = $errors;
                $this->Flash->danger(__d('system', 'Configuration could not be saved, please check your information.'));
            }
        }

        $pluginSettings = plugin()
            ->filter(function ($plugin) {
                return !$plugin->isTheme && $plugin->hasSettings;
            });

        $this->title(__d('system', 'Site’ Configuration'));
        $this->set(compact('arrayContext', 'languages', 'variables', 'pluginSettings'));
        $this->Breadcrumb->push('/admin/system/configuration');
    }
91437
public function onTranslationList()
    {
        $this->breadcrumbs->register('translations', function($breadcrumbs) {
            $breadcrumbs->push('Translations', handles('antares::translations/index/' . area()));
        });

        $this->shareOnView('translations');
    }