Skip to content

Commit

Permalink
Add __nova() translation function
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarpsvo committed Nov 17, 2020
1 parent 2c0b991 commit 1eeacfe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
"autoload": {
"psr-4": {
"OptimistDigital\\NovaTranslationsLoader\\": "src/"
}
},
"files": [
"./src/helpers.php"
]
},
"extra": {
"laravel": {
Expand Down
10 changes: 10 additions & 0 deletions src/helpers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

if (!function_exists('__nova')) {
function __nova($key, $replacements = [], $locale = null, $fallback = true)
{
$line = __($key, $replacements, $locale, $fallback);
if (!isset($line) || $line === $key) $line = __($key, $replacements, app()->getFallbackLocale(), $fallback);
return $line;
}
}

0 comments on commit 1eeacfe

Please sign in to comment.