-
Docs
Backend
-
Behaviors
-
Classes
-
Controllers
-
Database
-
Seeds
-
-
Facades
-
FormWidgets
-
Helpers
-
Exception
- Backend
-
-
Models
-
ReportWidgets
-
Skins
-
Traits
-
Widgets
- ServiceProvider
-
-
Cms
-
Classes
- Asset
- AutoDatasource
- CmsCompoundObject
- CmsController
- CmsException
- CmsObject
- CmsObjectCollection
- CodeBase
- CodeParser
- ComponentBase
- ComponentHelpers
- ComponentManager
- ComponentPartial
- Content
- Controller
- Layout
- LayoutCode
- MediaLibrary
- MediaLibraryItem
- MediaViewHelper
- Meta
- ObjectMemoryCache
- Page
- PageCode
- Partial
- PartialCode
- PartialStack
- Router
- Theme
- ThemeManager
-
Components
-
Contracts
-
Controllers
-
Facades
-
FormWidgets
-
Helpers
-
Models
-
ReportWidgets
-
Traits
-
Twig
- ComponentNode
- ComponentTokenParser
- ContentNode
- ContentTokenParser
- DebugExtension
- DefaultNode
- DefaultTokenParser
- Extension
- FlashNode
- FlashTokenParser
- FrameworkNode
- FrameworkTokenParser
- Loader
- PageNode
- PageTokenParser
- PartialNode
- PartialTokenParser
- PlaceholderNode
- PlaceholderTokenParser
- PutNode
- PutTokenParser
- ScriptsNode
- ScriptsTokenParser
- StylesNode
- StylesTokenParser
-
Widgets
- ServiceProvider
-
-
System
-
Behaviors
-
Classes
-
Console
-
Controllers
-
Database
-
Helpers
-
Models
-
ReportWidgets
-
Traits
-
Twig
- ServiceProvider
-
-
Events
-
backend
-
ajax
-
filter
-
form
-
list
-
menu
-
page
-
user
-
-
cms
-
ajax
-
block
-
combiner
-
component
-
object
-
page
-
router
-
template
-
theme
-
-
halcyon
-
datasource
-
-
mailer
-
media
-
model
-
system
-
assets
-
console
-
mirror
-
theme
-
-
reportwidgets
-
settings
- extendConfigFile
-
-
translator
-
-
Library
-
Argon
-
Auth
-
Models
- AuthException
- Manager
-
-
Config
-
Cookie
-
Middleware
-
-
Database
-
Attach
-
Behaviors
-
Concerns
-
Connections
-
Connectors
-
Models
-
Relations
-
Schema
-
Traits
-
Updates
- README
- Builder
- Collection
- DatabaseServiceProvider
- DataFeed
- Dongle
- MemoryCache
- Model
- ModelBehavior
- ModelException
- NestedTreeScope
- Pivot
- QueryBuilder
- SortableScope
- TreeCollection
- Updater
-
-
Events
-
Exception
-
Extension
-
Filesystem
-
Flash
-
Foundation
-
Bootstrap
-
Console
-
Exception
-
Http
-
Middleware
- Kernel
-
-
Providers
- Application
- Maker
-
-
Halcyon
-
Datasource
-
Exception
-
Processors
-
Traits
- README
- Builder
- Collection
- HalcyonServiceProvider
- MemoryCacheManager
- MemoryRepository
- Model
-
-
Html
-
Mail
-
Network
-
Parse
-
Router
-
Scaffold
-
Support
-
Translation
-
- Documentation
- API
- Library
- Translation
- Translator
October\Rain\Translation\Translator
Source: ~/vendor/october/rain/src/Translation/Translator.php
Implements:
- Illuminate\Contracts\Translation\Translator
October translator class.
Protected properties
protected October\Rain\Translation\LoaderInterface $loader
The loader implementation.
protected string $locale
The default locale being used by the translator.
protected string $fallback
The fallback locale used by the translator.
protected array $loaded
The array of loaded translation groups.
protected Illuminate\Contracts\Events\Dispatcher|\October\Rain\Events\Dispatcher $events
The event dispatcher instance.
protected array $keyParserCache
A cache of the parsed items.
Public methods
public void __construct(October\Rain\Translation\LoaderInterface $loader, string $locale)
Create a new translator instance.
Parameters
- October\Rain\Translation\LoaderInterface $loader
- string $locale
public void addNamespace(string $namespace, string $hint)
Add a new namespace to the loader.
Parameters
- string $namespace
- string $hint
public string choice(string $key, int $number, array $replace=array(), string $locale=NULL)
Get a translation according to an integer value.
Parameters
- string $key
- int $number
- array $replace
- string $locale
public string get(string $key, array $replace=array(), string $locale=NULL)
Get the translation for the given key.
Parameters
- string $key
- array $replace
- string $locale
public string getFallback()
Get the fallback locale being used.
public October\Rain\Translation\LoaderInterface getLoader()
Get the language line loader implementation.
public string getLocale()
Get the default locale being used.
public Symfony\Component\Translation\MessageSelector getSelector()
Get the message selector instance.
public bool has(string $key, string $locale=NULL)
Determine if a translation exists.
Parameters
- string $key
- string $locale
public void load(string $namespace, string $group, string $locale)
Load the specified language group.
Parameters
- string $namespace
- string $group
- string $locale
public string locale()
Get the default locale being used.
public array parseKey(string $key)
Parse a key into namespace, group, and item.
Parameters
- string $key
public void setEventDispatcher(Illuminate\Contracts\Events\Dispatcher $events)
Set the event dispatcher instance.
Parameters
- Illuminate\Contracts\Events\Dispatcher $events
public void setFallback(string $fallback)
Set the fallback locale being used.
Parameters
- string $fallback
public void setLocale(string $locale)
Set the default locale.
Parameters
- string $locale
public void setParsedKey(string $key, array $parsed)
Set the parsed value of a key.
Parameters
- string $key
- array $parsed
public void setSelector(Symfony\Component\Translation\MessageSelector $selector)
Set the message selector instance.
Parameters
- Symfony\Component\Translation\MessageSelector $selector
public string trans(string $id, array $parameters=array(), string $domain='messages', string $locale=NULL)
Get the translation for a given key.
Parameters
- string $id
- array $parameters
- string $domain
- string $locale
public string transChoice(string $id, int $number, array $parameters=array(), string $domain='messages', string $locale=NULL)
Get a translation according to an integer value.
Parameters
- string $id
- int $number
- array $parameters
- string $domain
- string $locale
Protected methods
protected string|null getLine(string $namespace, string $group, string $locale, string $item, array $replace)
Retrieve a language line out the loaded array.
Parameters
- string $namespace
- string $group
- string $locale
- string $item
- array $replace
protected string getValidationSpecific(string $key, array $replace, string $locale)
Check the system namespace by default for "validation" keys.
Parameters
- string $key
- array $replace
- string $locale
protected bool isLoaded(string $namespace, string $group, string $locale)
Determine if the given group has been loaded.
Parameters
- string $namespace
- string $group
- string $locale
protected array keyParserParseBasicSegments(array $segments)
Parse an array of basic segments.
Parameters
- array $segments
protected array keyParserParseSegments(string $key)
Parse an array of namespaced segments.
Parameters
- string $key
protected string makeReplacements(string $line, array $replace)
Make the place-holder replacements on a line.
Parameters
- string $line
- array $replace
protected array parseLocale(string|null $locale)
Get the array of locales to be checked.
Parameters
- string|null $locale
protected array sortReplacements(array $replace)
Sort the replacements array.
Parameters
- array $replace