private function saveTranslationFile($contents, MutableBag $tr)
    {
        $contents = Input::cleanPostedData($contents) . "\n";

        // Clear any warning for file not found, we are creating it here
        // we'll set an error if someone still submits the form and write is not allowed
        $this->flashes()->clear();

        $file = $this->filesystem()->getFile('bolt://' . $tr->get('shortPath'));
        try {
            $file->put($contents);
        } catch (IOException $e) {
            $msg = Trans::__('general.phrase.file-not-writable', ['%s' => $tr->get('shortPath')]);
            $this->flashes()->error($msg);
            $tr['writeallowed'] = false;

            return false;
        }

        $msg = Trans::__('page.file-management.message.save-success', ['%s' => $tr->get('shortPath')]);
        $this->flashes()->info($msg);

        return $this->redirectToRoute('translation', ['domain' => $tr->get('domain'), 'tr_locale' => $tr->get('locale')]);
    }