Some better activity translations
This commit is contained in:
parent
cf01490883
commit
76472411e3
5 changed files with 34 additions and 13 deletions
|
@ -57,7 +57,16 @@ class LocaleController extends Controller
|
|||
if (is_array($value)) {
|
||||
$data[$key] = $this->i18n($value);
|
||||
} else {
|
||||
$data[$key] = preg_replace('/:([\w-]+)(\W?|$)/m', '{{$1}}$2', $value);
|
||||
// Find a Laravel style translation replacement in the string and replace it with
|
||||
// one that the front-end is able to use. This won't always be present, especially
|
||||
// for complex strings or things where we'd never have a backend component anyways.
|
||||
//
|
||||
// For example:
|
||||
// "Hello :name, the :notifications.0.title notification needs :count actions :foo.0.bar."
|
||||
//
|
||||
// Becomes:
|
||||
// "Hello {{name}}, the {{notifications.0.title}} notification needs {{count}} actions {{foo.0.bar}}."
|
||||
$data[$key] = preg_replace('/:([\w.-]+\w)([^\w:]?|$)/m', '{{$1}}$2', $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue