Q:

Laravel 5: Why can't I use integers and floating point numbers in the language files?

Suppose I have this language file resources/lang/en/settings.php in a Laravel 5 project I'm working on. And this file looks like this:
<?php
    return [
        "key_1" => 50,
        "key_2" => "50",
    ];

Now if I wanted to get the value of key_1 like this:
return trans("settings.key_1"); // returns "settings.key_1"

This will return settings.key_1 which is not 50, the value I expect. On the other hand, if I tried to get the value of key_2 which is also 50 but this time as a string, it will return 50 as expected.
return trans("settings.key_2"); // returns 50

So, Why can't I use numbers in the language files, Why the values must be strings?

A:

From the sourcecode:
Lets start at the trans function that you are calling.
/**
 * Get the translation for a given key.
 */
public function trans($id, array $parameters = [], $domain = 'messages', $locale = null)
{
    return $this->get($id, $parameters, $locale);
}

The get function called by $this->get()
/**
 * Get the translation for the given key.
 */
public function get($key, array $replace = [], $locale = null, $fallback = true)
{
    list($namespace, $group, $item) = $this->parseKey($key);
    // Here we will get the locale that should be used for the language line. If one
    // was not passed, we will use the default locales which was given to us when
    // the translator was instantiated. Then, we can load the lines and return.
    $locales = $fallback ? $this->parseLocale($locale) : [$locale ?: $this->locale];
    foreach ($locales as $locale) {
        $this->load($namespace, $group, $locale);
        $line = $this->getLine(
            $namespace, $group, $locale, $item, $replace
        );
        if (! is_null($line)) {
            break;
        }
    }
    // If the line doesn't exist, we will return back the key which was requested as
    // that will be quick to spot in the UI if language keys are wrong or missing
    // from the application's language files. Otherwise we can return the line.
    if (! isset($line)) {
        return $key;
    }
    return $line;
}

As you can see here:
    // If the line doesn't exist, we will return back the key which was requested as
    // that will be quick to spot in the UI if language keys are wrong or missing
    // from the application's language files. Otherwise we can return the line.
    if (! isset($line)) {
        return $key;
    }

The value has not a valid value so isset is not passed therefore it will return the $key value which is the key you requested.
To go even further we can look at the following function which was called in the get function.
/**
 * Retrieve a language line out the loaded array.
 */
protected function getLine($namespace, $group, $locale, $item, array $replace)
{
    $line = Arr::get($this->loaded[$namespace][$group][$locale], $item);
    if (is_string($line)) {
        return $this->makeReplacements($line, $replace);
    } elseif (is_array($line) && count($line) > 0) {
        return $line;
    }
}

Here we se the following:
    if (is_string($line)) {

This is where the framework actualy checks if the value is a string.

