Adds locale to a job synchronously.

@param string $jobId
@param string $localeId
@param AddLocaleToJobParameters $parameters
@throws SmartlingApiException
542625
public function addLocaleToJobSync($jobId, $localeId, AddLocaleToJobParameters $parameters)
    {
        $endpoint = vsprintf('jobs/%s/locales/%s', [$jobId, $localeId]);
        $requestData = $this->getDefaultRequestData('json', $parameters->exportToArray());
        $this->wait($this->sendRequest($endpoint, $requestData, self::HTTP_METHOD_POST));
    }
695343
@Override
  public void localizeConfiguration(JobConf conf) throws IOException {
    super.localizeConfiguration(conf);
    conf.setNumMapTasks(numMaps);
  }
732459
private static void createLocales(TypeSpec.Builder type, List<LocaleID> defaultContent, Set<LocaleID> available) {
    TypeSpec.Builder localeInterface = TypeSpec.interfaceBuilder("Locale")
        .addModifiers(PUBLIC, STATIC)
        .addMethod(MethodSpec.methodBuilder("language")
            .addModifiers(PUBLIC, ABSTRACT)
            .returns(String.class).build())
        .addMethod(MethodSpec.methodBuilder("script")
            .addModifiers(PUBLIC, ABSTRACT)
            .returns(String.class).build())
        .addMethod(MethodSpec.methodBuilder("territory")
            .addModifiers(PUBLIC, ABSTRACT)
            .returns(String.class).build())
        .addMethod(MethodSpec.methodBuilder("variant")
            .addModifiers(PUBLIC, ABSTRACT)
            .returns(String.class).build())
        .addMethod(MethodSpec.methodBuilder("compact")
            .addModifiers(PUBLIC, ABSTRACT)
            .returns(String.class).build())
        .addMethod(MethodSpec.methodBuilder("expanded")
            .addModifiers(PUBLIC, ABSTRACT)
            .returns(String.class).build());
    
    List<LocaleID> localeFields = new ArrayList<>();
    List<String> allLocales = new ArrayList<>();
    List<String> bundles = new ArrayList<>();
    
    for (LocaleID locale : available) {
      localeFields.add(locale);
      allLocales.add(locale.safe);
      bundles.add(locale.safe);
    }
    
    MethodSpec.Builder method = MethodSpec.methodBuilder("registerDefaultContent")
        .addModifiers(PRIVATE, STATIC);
    
    for (LocaleID locale : defaultContent) {
      LocaleID dest = new LocaleID(locale.language, "", "", "");
      if (available.contains(dest)) {
        localeFields.add(locale);
        allLocales.add(locale.safe);
        method.addStatement("DEFAULT_CONTENT.put(Locale.$L, Locale.$L)",
            locale.safe,
            dest.safe);
      }
    }
    type.addMethod(method.build());

    Collections.sort(localeFields);
    for (LocaleID locale : localeFields) {
      addLocaleField(localeInterface, locale.safe, locale);
    }

    StringBuilder buf = new StringBuilder("$T.unmodifiableList($T.asList(\n");
    for (int i = 0; i < allLocales.size(); i++) {
      if (i > 0) {
        buf.append(",\n");
      }
      buf.append("  Locale.$L");
    }
    buf.append("))");

    Collections.sort(allLocales);
    
    List<Object> arguments = new ArrayList<>();
    arguments.add(Collections.class);
    arguments.add(Arrays.class);
    arguments.addAll(allLocales);
    
    FieldSpec.Builder field = FieldSpec.builder(LIST_CLDR_LOCALE_IF, "AVAILABLE_LOCALES", PRIVATE, STATIC, FINAL);
    field.initializer(buf.toString(), arguments.toArray());
    type.addField(field.build());
    
    buf = new StringBuilder("$T.unmodifiableList($T.asList(\n");
    for (int i = 0; i < bundles.size(); i++) {
      if (i > 0) {
        buf.append(",\n");
      }
      buf.append("  Locale.$L");
    }
    buf.append("))");
    
    Collections.sort(bundles);
    arguments = new ArrayList<>();
    arguments.add(Collections.class);
    arguments.add(Arrays.class);
    arguments.addAll(bundles);
    
    field = FieldSpec.builder(LIST_CLDR_LOCALE_IF, "AVAILABLE_BUNDLES", PRIVATE, STATIC, FINAL);
    field.initializer(buf.toString(), arguments.toArray());
    type.addField(field.build());
    
    method = MethodSpec.methodBuilder("availableLocales")
        .addModifiers(PUBLIC, FINAL)
        .returns(LIST_CLDR_LOCALE_IF)
        .addStatement("return AVAILABLE_LOCALES");
    
    type.addMethod(method.build());
    
    method = MethodSpec.methodBuilder("availableBundles")
        .addModifiers(PUBLIC, FINAL)
        .returns(LIST_CLDR_LOCALE_IF)
        .addStatement("return AVAILABLE_BUNDLES");
    
    type.addMethod(method.build());

    type.addType(localeInterface.build());
  }
1168438
public void localizeConfiguration(JobConf conf) throws IOException {
    conf.set("mapred.tip.id", taskId.getTaskID().toString()); 
    conf.set("mapred.task.id", taskId.toString());
    conf.setBoolean("mapred.task.is.map", isMapTask());
    conf.setInt("mapred.task.partition", partition);
    conf.set("mapred.job.id", taskId.getJobID().toString());
  }
1310853
public function cancelJobSync($jobId, CancelJobParameters $parameters)
    {
        $endpoint = vsprintf('jobs/%s/cancel', [$jobId]);
        $requestData = $this->getDefaultRequestData('json', $parameters->exportToArray());
        $this->wait($this->sendRequest($endpoint, $requestData, self::HTTP_METHOD_POST));
    }
848415
public static void addJob(
      String jobName,
      Class<? extends Job> jobClass,
      Map<String, Object> params,
      boolean isConcurrencyAllowed)
      throws SundialSchedulerException {

    try {
      JobDataMap jobDataMap = new JobDataMap();
      if (params != null) {
        for (Entry<String, Object> entry : params.entrySet()) {
          jobDataMap.put(entry.getKey(), entry.getValue());
        }
      }

      JobDetail jobDetail =
          newJobBuilder(jobClass)
              .withIdentity(jobName)
              .usingJobData(jobDataMap)
              .isConcurrencyAllowed(isConcurrencyAllowed)
              .build();

      getScheduler().addJob(jobDetail);

    } catch (SchedulerException e) {
      logger.error("ERROR ADDING JOB!!!", e);
      throw new SundialSchedulerException("ERROR ADDING JOB!!!", e);
    }
  }
591127
protected static function addTranslate( \Aimeos\MW\View\Iface $view, $langid, array $local )
	{
		if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_view_translate'] )
			&& is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_view_translate'] ) )
		) {
			return $fcn( $view, $langid, $local );
		}

		if( $langid )
		{
			$i18n = \Aimeos\Aimeos\Base::getI18n( array( $langid ), $local );
			$translation = $i18n[$langid];
		}
		else
		{
			$translation = new \Aimeos\MW\Translation\None( 'en' );
		}

		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation );
		$view->addHelper( 'translate', $helper );

		return $view;
	}
1011489
public function Locales($Op = NULL, $LocaleKey = NULL, $TransientKey = NULL) {
      $this->Permission('Garden.Settings.Manage');

      $this->Title(T('Locales'));
      $this->AddSideMenu('dashboard/settings/locales');
      $this->AddJsFile('addons.js');

      $LocaleModel = new LocaleModel();

      // Get the available locale packs.
      $AvailableLocales = $LocaleModel->AvailableLocalePacks();

      // Get the enabled locale packs.
      $EnabledLocales = $LocaleModel->EnabledLocalePacks();

      // Check to enable/disable a locale.
      if (Gdn::Session()->ValidateTransientKey($TransientKey) || $this->Form->AuthenticatedPostBack()) {
         if ($Op) {
            $Refresh = FALSE;
            switch(strtolower($Op)) {
               case 'enable':
                  $Locale = GetValue($LocaleKey, $AvailableLocales);
                  if (!is_array($Locale)) {
                     $this->Form->AddError('@'.sprintf(T('The %s locale pack does not exist.'), htmlspecialchars($LocaleKey)), 'LocaleKey');
                  } elseif (!isset($Locale['Locale'])) {
                     $this->Form->AddError('ValidateRequired', 'Locale');
                  } else {
                     SaveToConfig("EnabledLocales.$LocaleKey", $Locale['Locale']);
                     $EnabledLocales[$LocaleKey] = $Locale['Locale'];
                     $Refresh = TRUE;
                  }
                  break;
               case 'disable':
                  RemoveFromConfig("EnabledLocales.$LocaleKey");
                  unset($EnabledLocales[$LocaleKey]);
                  $Refresh = TRUE;
                  break;
            }
            
            // Set default locale field if just doing enable/disable
            $this->Form->SetValue('Locale', C('Garden.Locale', 'en-CA'));
         } elseif ($this->Form->IsPostBack()) {
            // Save the default locale.
            SaveToConfig('Garden.Locale', $this->Form->GetFormValue('Locale'));
            $Refresh = TRUE;
            $this->InformMessage(T("Your changes have been saved."));
         }

         if ($Refresh)
            Gdn::Locale()->Refresh();
      } elseif (!$this->Form->IsPostBack()) {
         $this->Form->SetValue('Locale', C('Garden.Locale', 'en-CA'));
      }

      // Check for the default locale warning.
      $DefaultLocale = C('Garden.Locale');
      if ($DefaultLocale != 'en-CA') {
         $LocaleFound = FALSE;
         $MatchingLocales = array();
         foreach ($AvailableLocales as $Key => $LocaleInfo) {
            $Locale = GetValue('Locale', $LocaleInfo);
            if ($Locale == $DefaultLocale)
               $MatchingLocales[] = GetValue('Name', $LocaleInfo, $Key);

            if (GetValue($Key, $EnabledLocales) == $DefaultLocale)
               $LocaleFound = TRUE;
               
         }
         $this->SetData('DefaultLocaleWarning', !$LocaleFound);
         $this->SetData('MatchingLocalePacks', htmlspecialchars(implode(', ', $MatchingLocales)));
      }
      
      $this->SetData('AvailableLocales', $AvailableLocales);
      $this->SetData('EnabledLocales', $EnabledLocales);
      $this->SetData('Locales', $LocaleModel->AvailableLocales());
      $this->Render();
   }
46038
public void setLocale(final Locale locale) {
        if (!equals(this.locale, locale)) {
            this.locale = locale;
            super.setValue(toString(locale));
            i18nBundleProvider.reloadBundles(locale);
        }
    }
863167
void setLocale(Locale locale)
   {
      m_resourceNames = LocaleData.getStringArray(locale, LocaleData.RESOURCE_NAMES);

      String name;
      m_resourceNumbers.clear();

      for (int loop = 0; loop < m_resourceNames.length; loop++)
      {
         name = m_resourceNames[loop];
         if (name != null)
         {
            m_resourceNumbers.put(name, Integer.valueOf(loop));
         }
      }
   }
997580
public function create(string $projectKey, string $localeId, string $keyId, string $content, array $params = [])
    {
        $params['locale_id'] = $localeId;
        $params['key_id'] = $keyId;
        $params['content'] = $content;

        $response = $this->httpPost(sprintf('/api/v2/projects/%s/translations', $projectKey), $params);

        if (!$this->hydrator) {
            return $response;
        }

        if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 201) {
            $this->handleErrors($response);
        }

        return $this->hydrator->hydrate($response, TranslationCreated::class);
    }
612597
public void setLocales(Locale... locales) {

    String[] array = new String[locales.length];
    for (int i = 0; i < locales.length; i++) {
      array[i] = locales[i].toString();
    }
    setLocales(array);
  }
998446
private void setJobId(String id) {
    if (id != null && id.startsWith("job_") && id.length() > 4) {
      this.jobNumber = id.substring(4);
    }
  }
498851
@Override
  void initializeJob(JobID jobid) {
    for(String localDir : this.mapredLocalDirs) {
      File jobDirectory = new File(localDir, 
          TaskTracker.getLocalJobDir(jobid.toString()));
      if(!jobDirectory.exists()) {
        if(!jobDirectory.mkdir()) {
          LOG.warn("Unable to create job cache directory : " 
              + jobDirectory.getPath());
          continue;
        }
      }
      //Should be recursive because the jar and work folders might be 
      //present under the job cache directory
      changeDirectoryPermissions(
          jobDirectory.getPath(), FILE_PERMISSIONS, true);
    }
  }
182671
public function indexLocale(string $projectKey, string $localeId, array $params = [])
    {
        if (isset($params['tags'])) {
            $params['q'] = 'tags:'.$params['tags'];
            unset($params['tags']);
        }

        $response = $this->httpGet(sprintf('/api/v2/projects/%s/locales/%s/translations', $projectKey, $localeId), $params);

        if (!$this->hydrator) {
            return $response;
        }

        if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 201) {
            $this->handleErrors($response);
        }

        return $this->hydrator->hydrate($response, Index::class);
    }
585996
protected function _addLocaleLanguageData( MShop_Common_Manager_Interface $localeManager, array $data )
	{
		$this->_msg( 'Adding data for MShop locale languages', 1 );

		$languageItemManager = $localeManager->getSubManager( 'language', 'Default' );

		$num = $total = 0;

		foreach( $data as $dataset )
		{
			$total++;
			$languageItem = $languageItemManager->createItem();
			$languageItem->setCode( $dataset['id'] );
			$languageItem->setLabel( $dataset['label'] );
			$languageItem->setStatus( $dataset['status'] );

			try {
				$languageItemManager->saveItem( $languageItem );
				$num++;
			} catch( Exception $e ) { ; } // if language was already available
		}

		$this->_status( $num > 0 ? $num . '/' . $total : 'OK' );
	}
496046
public void setLocale(final Locale LOCALE) {
        if (null == locale) {
            _locale = LOCALE;
            fireUpdateEvent(REDRAW_EVENT);
        } else {
            locale.set(LOCALE);
        }
    }