Sends an HTTP put request to update the translation for the given locale.

@param translation translation
@param locale      locale
@param outdated    outdated
169027
private void sendTranslationUpdate(String translation, String locale, boolean outdated) throws JSONException {
        JSONObject jsonTranslationValueObject = new JSONObject();
        jsonTranslationValueObject.put("translation", translation);
        jsonTranslationValueObject.put("outdated", outdated);
        jsonTranslationValueObject.put("locale", locale);
        jsonTranslationValueObject.put("approx", true);
        jsonTranslation.put("target", jsonTranslationValueObject);

        // Translate in english
        httpPut("translations/" + locale + "/" + keyName, jsonTranslation.toString());
    }
358305
public static void setLocale(final HttpServletRequest request, final Locale locale) {
        final HttpSession session = request.getSession(false);

        if (null == session) {
            LOGGER.warn("Ignores set locale caused by no session");

            return;
        }

        session.setAttribute(Keys.LOCALE, locale);
        LOGGER.log(Level.DEBUG, "Client[sessionId={0}] sets locale to [{1}]", new Object[]{session.getId(), locale.toString()});
    }
101671
public function setTranslation($locale, $translation, $isUpdate = true)
    {
        $this->offsetSet($locale, $translation);
        if ($isUpdate) {
            $this->setIsModified(true);
        }
    }
1266644
function translate(locale) {
    // Check to see if we have the locale translation data available. If not, fetch it via Ajax.
    if(_locales[locale] === undefined) {
      $.getJSON(getLocaleAssetUrl(locale), function (localeData) {
        // Store the returned locale data.
        _locales[locale] = localeData;
        // Try to perform translation again.
        translate(locale);
      });
      return;
    }

    // Translate elements to the given locale.
    $('[data-translate]').each(function(i, element) {
      translateElement(element, locale);
    });

    // Save the chosen locale in a cookie.
    localeCookie.write(locale);
  }
581123
@PUT
    @Path("/{key}")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @RequiresPermissions(I18nPermissions.TRANSLATION_WRITE)
    public Response updateTranslation(@PathParam("key") String keyName, TranslationRepresentation representation) {
        WebAssertions.assertNotNull(representation, "The translation should not be null");
        TranslationValueRepresentation translationToUpdate = representation.getTarget();
        WebAssertions.assertNotNull(translationToUpdate, "The translation target should not be null");

        Key key = keyRepository.get(keyName).orElseThrow(() -> new NotFoundException("The key is not found"));
        key.addTranslation(locale, translationToUpdate.getTranslation(), translationToUpdate.isApprox());
        keyRepository.update(key);

        return Response.noContent().build();
    }
585818
function(stream, locale, fileExt) {
					archive.append(stream, { name: locale + '/translation.' + fileExt });
					if (++count === lenLocales) {
						archive.finalize();
					}
				}
513160
public function translate($key, $translation, $locale = null) {
        $this->translations[$this->locale($locale)][$key] = $translation;

        return $translation;
    }
867715
public void setLocale(Locale locale) {
		if (!initialized) {
			super.setLocale(locale);
		} else {
			this.locale = locale;
			super.setLocale(locale);
			init();
		}
	}
1194413
private String messageImportUpdate(Locale locale) {

        return Messages.get().getBundle(locale).key(Messages.ERR_ALIAS_IMPORT_UPDATED_0);
    }
908615
public void addLocale(final LocaleId locale) {
        synchronized (this.locales) {
            if (this.locales == null) {
                this.locales = new ArrayList<LocaleId>();
            }
            this.locales.add(locale);
        }
    }
496046
public void setLocale(final Locale LOCALE) {
        if (null == locale) {
            _locale = LOCALE;
            fireUpdateEvent(REDRAW_EVENT);
        } else {
            locale.set(LOCALE);
        }
    }
416958
def help_center_section_translation_update(self, section_id, locale, data, **kwargs):
        ""
        api_path = "/api/v2/help_center/sections/{section_id}/translations/{locale}.json"
        api_path = api_path.format(section_id=section_id, locale=locale)
        return self.call(api_path, method="PUT", data=data, **kwargs)
329320
public void removeTranslation(String locale) {
        LocaleCodeSpecification.assertCode(locale);

        Translation translation = getTranslation(locale);
        if (translation != null) {
            this.translations.remove(translation.getId());
        }
    }
779527
protected void setLocale( HttpServletRequest request, Locale locale )
    {

        HttpSession session = request.getSession();
        if ( locale == null )
        {
            locale = getDefaultLocale();
        }
        session.setAttribute( Globals.LOCALE_KEY, locale );

    }
541362
def addTranslation(self,translation):
        '''
        '''
        if isinstance(translation, Translation):
            self.translations.append(translation)
        else:
            raise(TranslationError,
                   'translation Type should be Translation, not %s' % type(
                    translation)
                   )
707530
function serveMagicLocale(request, response) {
    var default_locale_id = 'en-gb',
        found_locale, negotiator;

    if (!request.headers['accept-language']) {
        // No accept-language specified in the request so send the default
        found_locale = default_locale_id;

    } else {
        negotiator = new Negotiator(request);
        found_locale = negotiator.language(cached_available_locales);

        // If a locale couldn't be negotiated, use the default
        found_locale = found_locale || default_locale_id;
    }

    // Send a locale to the browser
    this.file_server.serveFile('/assets/locales/' + found_locale + '.json', 200, {
        Vary: 'Accept-Language',
        'Content-Language': found_locale
    }, request, response);
}
923108
public function addTranslation(Translation $translation)
    {
        $translation->setRepository($this);
        $this
            ->translationCollection
            ->addTranslation($translation);
    }