Download the PHP package richardsjoqvist/silverstripe-localdate without Composer
On this page you can find all versions of the php package richardsjoqvist/silverstripe-localdate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download richardsjoqvist/silverstripe-localdate
More information about richardsjoqvist/silverstripe-localdate
Files in richardsjoqvist/silverstripe-localdate
Package silverstripe-localdate
Short Description Translates formatted date strings to the locale set with i18n::set_locale() if there is a matching language file.
License
Homepage https://github.com/richardsjoqvist/silverstripe-localdate
Informations about the package silverstripe-localdate
LocalDate SilverStripe module
LocalDate translates formatted date strings if there is a matching language file.
Requirements
- SilverStripe 3.1 (this module will probably not be updated to SilverStripe 4)
Notes
- Compatible with Translatable
Installation
- Drop the module into your SilverStripe project and run /dev/build
- Set the correct locale in your project
_config.php
usingi18n::set_locale('xx_XX');
You may also set the language manually using LocalDateHelper::setLocale('xx_XX');
at any time.
Usage
The module will extend and override SS_Datetime and Date. Existing dates will be automatically translated as long as a valid language file exists as long as they are of SS_Datetime or Date type.
The locale for the translated date is based on (in order):
- Any valid locale set with the
LocalDateHelper::setLocale('xx_XX');
- The current locale for
Translatable
if the module is installed - The current i18n-setting
If the language file for your locale is missing you can easily create it yourself. Simply use one of the included language files as a template and save it to your /mysite/lang
folder. Better yet, fork this repo and add it to the lang-folder and send me a pull request. Sending me an email (mailto:[email protected]) with the translated file attached will also do the trick.