diff --git a/Controller/SymfonyProfilerController.php b/Controller/SymfonyProfilerController.php
index 41a54e9..495448f 100644
--- a/Controller/SymfonyProfilerController.php
+++ b/Controller/SymfonyProfilerController.php
@@ -64,7 +64,8 @@ public function editAction(Request $request, string $token): Response
$translation = $this->storage->syncAndFetchMessage($message->getLocale(), $message->getDomain(), $message->getKey());
$content = $this->twig->render('@Translation/SymfonyProfiler/edit.html.twig', [
- 'message' => $translation,
+ 'translation' => $translation,
+ 'message' => $message,
'key' => $request->query->get('message_id'),
]);
@@ -72,6 +73,12 @@ public function editAction(Request $request, string $token): Response
}
// Assert: This is a POST request
+ if ('save_for_default' === $request->request->get('action')) {
+ $requestCollector = $this->getProfiler()->loadProfile($token)->getCollector('translation');
+ if ($requestCollector instanceof TranslationDataCollector) {
+ $message->setLocale($requestCollector->getLocale());
+ }
+ }
$message->setTranslation((string) $request->request->get('translation'));
$this->storage->update($message->convertToMessage());
diff --git a/Resources/public/js/symfonyProfiler.js b/Resources/public/js/symfonyProfiler.js
index 6cdd57b..8ddee13 100644
--- a/Resources/public/js/symfonyProfiler.js
+++ b/Resources/public/js/symfonyProfiler.js
@@ -69,13 +69,13 @@ function getEditForm(key) {
});
}
-function saveEditForm(key, translation) {
+function saveEditForm(key, translation, additionalData = {}) {
var el = document.getElementById(key).getElementsByClassName("translation");
el[0].innerHTML = getLoaderHTML();
fetch(translationEditUrl, {
method: 'POST',
- body: serializeQueryString({message_id: key, translation:translation}),
+ body: serializeQueryString(Object.assign({message_id: key, translation:translation}, additionalData)),
headers: {
'X-Requested-With': 'XMLHttpRequest',
'Content-Type': 'application/x-www-form-urlencoded',
diff --git a/Resources/views/SymfonyProfiler/edit.html.twig b/Resources/views/SymfonyProfiler/edit.html.twig
index 2a52846..3679331 100644
--- a/Resources/views/SymfonyProfiler/edit.html.twig
+++ b/Resources/views/SymfonyProfiler/edit.html.twig
@@ -1,3 +1,8 @@
-
-
-
+
+{% if message.state == constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK') %}
+
+
+{% else %}
+
+{% endif %}
+