Delete a master language file from Web Translate It by performing a DELETE Request.
160965
def delete(http_connection)
      success = true
      tries ||= 3
      display = []
      display.push file_path
      if File.exists?(self.file_path)
        File.open(self.file_path) do |file|
          begin
            request = Net::HTTP::Delete.new(api_url_for_delete)
            WebTranslateIt::Util.add_fields(request)
            display.push Util.handle_response(http_connection.request(request))
            puts ArrayUtil.to_columns(display)
          rescue Timeout::Error
            puts StringUtil.failure("Request timeout. Will retry in 5 seconds.")
            if (tries -= 1) > 0
              sleep(5)
              retry
            else
              success = false
            end
          rescue
            display.push StringUtil.failure("An error occured: #{$!}")
            success = false
          end
        end
      else
        puts StringUtil.failure("\nFile #{self.file_path} doesn't exist!")
      end
      return success
    end
1150405
def help_center_translation_delete(self, id, **kwargs):
        ""
        api_path = "/api/v2/help_center/translations/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, method="DELETE", **kwargs)
1257125
public function cleanDataAction(ServerRequestInterface $request, FilesystemInterface $filesystem): ResponseInterface
    {
        $to_delete = (array) $request->get('to_delete');
        $to_delete = array_filter($to_delete);

        foreach ($to_delete as $path) {
            $metadata = $filesystem->getMetadata($path);

            if ($metadata === false) {
                // Already deleted?
                continue;
            }

            if ($metadata['type'] === 'dir') {
                try {
                    $filesystem->deleteDir($path);

                    FlashMessages::addMessage(I18N::translate('The folder %s has been deleted.', e($path)), 'success');
                } catch (Exception $ex) {
                    FlashMessages::addMessage(I18N::translate('The folder %s could not be deleted.', e($path)), 'danger');
                }
            }

            if ($metadata['type'] === 'file') {
                try {
                    $filesystem->delete($path);

                    FlashMessages::addMessage(I18N::translate('The file %s has been deleted.', e($path)), 'success');
                } catch (Exception $ex) {
                    FlashMessages::addMessage(I18N::translate('The file %s could not be deleted.', e($path)), 'danger');
                }
            }
        }

        return redirect(route('admin-clean-data'));
    }
707257
function () {
        var self = this;

        if (self.fileToDelete === null) {
            return;
        }

        fs.remove(self.fileToDelete, function (err) {
            if (err) {
                common.logging.error(new common.errors.GhostError({
                    err: err,
                    context: common.i18n.t('errors.data.importer.index.couldNotCleanUpFile.error'),
                    help: common.i18n.t('errors.data.importer.index.couldNotCleanUpFile.context')
                }));
            }

            self.fileToDelete = null;
        });
    }
730319
def delete_translation_values
      field_key = FieldKey.find_by_global_key(params[:i18n_key])
      field_key.visible = false

      # not convinced it makes sense to delete the associated translations
      # phrases = I18n::Backend::ActiveRecord::Translation.where(:key => params[:i18n_key])
      # phrases.destroy_all

      field_key.save!
      render json: { success: true }
    end
215988
public function delete(string $id = null)
    {
        $this->request->allowMethod(['post', 'delete']);
        $translation = $this->Translations->get($id);
        if ($this->Translations->delete($translation)) {
            $this->Flash->success((string)__('The translation has been deleted.'));
        } else {
            $this->Flash->error((string)__('The translation could not be deleted. Please, try again.'));
        }

        return $this->redirect(['action' => 'index']);
    }
291842
public function removeAction(Request $request): Response
    {
        $form = $this->formFactory->deleteTranslation();
        $form->handleRequest($request);

        /** @var ContentInfo $contentInfo */
        $contentInfo = $form->getData()->getContentInfo();

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (TranslationDeleteData $data) {
                $contentInfo = $data->getContentInfo();

                foreach ($data->getLanguageCodes() as $languageCode => $selected) {
                    $this->contentService->deleteTranslation($contentInfo, $languageCode);

                    $this->notificationHandler->success(
                        $this->translator->trans(
                            /** @Desc("Translation '%languageCode%' removed from content '%name%'.") */
                            'translation.remove.success',
                            ['%languageCode%' => $languageCode, '%name%' => $contentInfo->name],
                            'translation'
                        )
                    );
                }

                return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
                    'locationId' => $contentInfo->mainLocationId,
                    '_fragment' => TranslationsTab::URI_FRAGMENT,
                ]));
            });

            if ($result instanceof Response) {
                return $result;
            }
        }

        return $this->redirect($this->generateUrl('_ezpublishLocation', [
            'locationId' => $contentInfo->mainLocationId,
            '_fragment' => TranslationsTab::URI_FRAGMENT,
        ]));
    }
1203949
def delete_translations(self, language=None):
        
        from .models import Translation

        return Translation.objects.delete_translations(obj=self, language=language)
1296992
def clean_translation(self):
        
        translation = self.cleaned_data['translation']

        if self.instance and self.instance.content_object:
            # do not allow string longer than translatable field
            obj = self.instance.content_object
            field = obj._meta.get_field(self.instance.field)
            max_length = field.max_length

            if max_length and len(translation) > max_length:
                raise forms.ValidationError(
                    _('The entered translation is too long. You entered '
                      '%(entered)s chars, max length is %(maxlength)s') % {
                        'entered': len(translation),
                        'maxlength': max_length,
                    }
                )
        else:
            raise forms.ValidationError(
                _('Can not store translation. First create all translation'
                  ' for this object')
            )
        return translation
906541
public function actionDelete()
    {
        
        $this->outVerbose("Deleting language '" . $this->options['language'] . "' for extension '" . $this->options['extension'] . "' ...");
    	
    	$dir = $this->buildLanguagePath($this->options['extension'], $this->options['language']);
        if (!tao_helpers_File::remove($dir, true)) {
        	$this->err("Could not delete language '" . $this->options['language'] . "' for extension '" . $this->options['extension'] . "'.", true);	
        }
        
        $this->outVerbose("Language '" . $this->options['language'] . "' for extension '" . $this->options['extension'] . "' successfully deleted.");
        
    }
730968
def generic_translate(frm=None, to=None, delete=''):
    
    if PY2:
        delete_dict = dict.fromkeys(ord(unicode(d)) for d in delete)

        if frm is None and to is None:
            string_trans = None
            unicode_table = delete_dict
        else:
            string_trans = string.maketrans(frm, to)
            unicode_table = dict(((ord(unicode(f)), unicode(t))
                for f, t in zip(frm, to)), **delete_dict)

        string_args = (string_trans, delete) if delete else (string_trans,)

        translate_args = [string_args, (unicode_table,)]

        def translate(basestr):
            args = translate_args[isinstance(basestr, unicode)]
            return basestr.translate(*args)

    else:
        string_trans = str.maketrans(frm or '', to or '', delete or '')

        def translate(basestr):
            return basestr.translate(string_trans)

    return translate
723088
protected function deleteTranslationFromService($selfEdit, $msgInstanceName, $key, $language = null)
    {
        $finePhpArrayTranslationService = new InstanceProxy($msgInstanceName, $selfEdit);
        $finePhpArrayTranslationService->deleteTranslation($key, $language);
    }
924426
private function doRemoveAllTranslations($document, ClassMetadata $metadata)
    {
        if (!$this->isDocumentTranslatable($metadata)) {
            return;
        }

        $node = $this->session->getNode($this->getDocumentId($document));
        $strategy = $this->dm->getTranslationStrategy($metadata->translator);
        $strategy->removeAllTranslations($document, $node, $metadata);
    }
1147731
void handleDelete(HttpRequest request,
                      HttpResponse response,
                      String pathInContext,
                      Resource resource)
        throws IOException
    {
        if(log.isDebugEnabled())log.debug("DELETE "+pathInContext+" from "+resource);  
 
        if (!resource.exists() ||
            !passConditionalHeaders(request,response,resource))
            return;
 
        try
        {
            // delete the file
            if (resource.delete())
                response.setStatus(HttpResponse.__204_No_Content);
            else
                response.sendError(HttpResponse.__403_Forbidden);

            // Send response
            request.setHandled(true);
        }
        catch (SecurityException sex)
        {
            log.warn(LogSupport.EXCEPTION,sex);
            response.sendError(HttpResponse.__403_Forbidden, sex.getMessage());
        }
    }
329320
public void removeTranslation(String locale) {
        LocaleCodeSpecification.assertCode(locale);

        Translation translation = getTranslation(locale);
        if (translation != null) {
            this.translations.remove(translation.getId());
        }
    }
1162481
def attach_translated_content(self, local_main_lang_page,
                                  content, locale):
        '''
        
        '''
        try:
            page = self.attach_page(
                local_main_lang_page.get_parent(),
                content)
        except:
            # TODO: log this
            return None

        try:
            # create the translation object for page
            language = SiteLanguageRelation.objects.get(
                language_setting=self.language_setting,
                locale=locale)
            page.language = language
            page.translated_pages.add(local_main_lang_page)
            local_main_lang_page.translated_pages.add(page)
            page.save()
            local_main_lang_page.save()
        except:
            # TODO: log that creating translation failed
            # TODO: log that page is now being deleted
            page.delete()
        return page
1187613
def destroy
      @category = @translation_key.category
      @translation_key_id = @translation_key.id
      @key_status = @translation_key.status(session[:lang_to])
      @translation_key.destroy
  
      respond_to do |format|
        format.js
        format.html {redirect_to @category, notice: I18n.t('translation_center.translation_keys.destroyed_successfully')}
      end
    end