How to achieve reverse localization (user input) on Laravel 5.x?
<blockquote>
  <p>Laravel's localization features provide a convenient way to retrieve strings in various languages, allowing to easily support multiple languages within the application.</p>
</blockquote>

<p>At this point I'm using the function <code>trans()</code> and related that ships with Laravel, to translate (localize) the user interface (output) of my application, as one would usually do with a default setup. As how this strategy works, we are translating <em>english</em> keys into another language. It is clear that <em>keys</em> need not to be in any particular language, and they don't even need to be readable text, that we just keep them readable for sake of software maintainability and comply a standard, since the programmatic keywords are in <em>english</em>.</p>

<p>My question is if there's a well known way to accurately translate user input in a selected language back to the base language (let's say <em>english</em>).</p>

<p>An example of this would be letting the user to write certain keywords or expressions in their language as input, and get them into a base language.</p>

<p>Currently, I would do something like this:</p>

<pre><code>// Dummy Sample Code I

$foreignInput = 'lunes';

$translatedToBase = trans("input.days.$foreignInput");

dd($translatedToBase); // "monday"

// lang/es/input.php

[
// ...
  'days' =&gt; [
    'lunes' =&gt; 'monday',
    // ...
  ],
// ...
]
</code></pre>

<p>I would also do something like this:</p>

<pre><code>// Dummy Sample Code II

$foreignInput = 'lun';

$translatedToBase = trans("input.days.$foreignInput");

dd($translatedToBase); // "mon"

// lang/es/input.php

[
// ...
  'days' =&gt; [
    'lun' =&gt; 'mon',
    // ...
  ],
// ...
]
</code></pre>

<p>This would perfectly work for the purpose, however, it feels <em>hacky</em> (unsafe, little reliable, hard to maintain and counter-intuitive) and I wonder if there's a package of better way to achieve this. I could even require not using <code>trans()</code>, that's fine for me.</p>

<p>I understand there may be lots of options, so suggestions are welcome as long as I can keep some constrains:</p>

<ul>
<li><p>Also please note that in this example I used a weekday name, but I'd not limit the solution to a datetime context.</p></li>
<li><p>Plus, I'm seeking to rely on the translation to be strict, this means that I'm expecting it to be deterministic, reason I'm putting aside a live translation external service.</p></li>
</ul>

<p>Thanks for reading!</p>