FluentTranslator
final class FluentTranslator implements Translator (View source)
Translator decorator that adds support for Fluent translations.
This class is adapted from the laravel-fluent
package. This version of the
class adds support for:
- Loading namespaced translations from .ftl files, and allowing them to be overridden by the consumer.
- Adding functions to FluentBundle instances.
- Accept an array of keys and use the first one that exists.
- Cache parsed Fluent bundles.
Methods
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Details
__construct(Translator $baseTranslator, Filesystem $files, string $path, string $locale, string $fallback, array $bundleOptions, string|null $cachePath = null, array $functions = [])
No description
bool
hasForLocale(string $key, string|null $locale = null)
No description
bool
has(string $key, string|null $locale = null, bool $fallback = true)
No description
string|array
get(string|array $key, array $replace = [], ?string $locale = null, bool $fallback = true)
No description
protected FluentBundle|false
loadPath(string $path, string $locale, string $group)
No description
void
flush()
No description
protected FluentBundle|false
loadNamespaced(string $locale, string $group, string $namespace)
No description
protected FluentBundle
loadNamespaceOverrides(FluentBundle $bundle, $locale, $group, $namespace)
No description
choice($key, $number, array $replace = [], $locale = null)
No description
void
addLines(array $lines, string $locale, string $namespace = '*')
No description
void
load(string $namespace, string $group, string $locale)
No description
void
addNamespace(string $namespace, string $hint)
No description
void
addJsonPath(string $path)
No description
array
parseKey(string $key)
No description
MessageSelector
getSelector()
No description
void
setSelector(MessageSelector $selector)
No description
Loader
getLoader()
No description
string
locale()
No description
string
getLocale()
No description
void
setLocale(string $locale)
No description
string
getFallback()
No description
void
setFallback(string $locale)
No description