Silverstripe 4.6 setup .env - vars, missing install.php, language? - installation

In the docs, they say, the install.php no longer exists within SS 4.6.x.
So you have to setup with .env - variables
my .env looks like this:
SS_BASE_URL="http://localhost/SS_4_6_1"
SS_DATABASE_CLASS="MySQLPDODatabase"
SS_DATABASE_NAME="ss_4_6_1"
SS_DATABASE_PASSWORD="root"
SS_DATABASE_SERVER="localhost"
SS_DATABASE_USERNAME="root"
SS_ENVIRONMENT_TYPE="dev"
SS_DEFAULT_ADMIN_USERNAME="XXX"
SS_DEFAULT_ADMIN_PASSWORD="XXX"
Doing a .../dev/build...
Database is created.
I know i can change Cms-language to German for the Default- admin in the CMS.
BUT all pages created while setup are in English. (inclusive Error - Pages) ??
CAN YOU CHANGE THE DEFAULT - LANGUAGE TO e.g. GERMAN FOR SETTING UP THE SITE?
EDIT: It would be nice, to set language in .env:
SS_DEFAULT_LOCALE="de_DE"

Yes, we can change the default language for setting up the site.
Before we run the initial dev/build we can add the following to our app config.yml:
SilverStripe\i18n\i18n:
default_locale: 'de'
When dev/build runs it will populate the default pages with the specified language.

Related

Laravel mcamara/laravel-localization package overrides config('app.locale')

I'm trying "mcamara/laravel-localization" package to localize my app and it works as expected except for one small issue, the package seems to override the config('app.locale') default value.
For instance if the default value of the locale property in config\app.php file is set to en end I changed the application language to french with the language switcher then config('app.locale') is evaluated to fr instead of the default en.
I hope the issue is clear so my question is: how can get the default locale as defined the config\app.php config file?
Thanks
whole point of that package is changing locale, no matter what the default locale is that package change it to whatever you config it to.
but you can get current locale anytime you want using currentLocale() method of App facade and change it with setLocale($yourLocale).
In order to get the current language code, write the following function:
app()->getLocale();
In order to activate the activation of a new language, you can write the following function:
app()->setLocale('fr');

SailsJS i18n module not changing lang file even the locale was changed

I debugging a SailsJS app, if I print the sails global variables it has the right values for locales, and defaultLocale, etc...
I changing the locale with Accept-Language header in PostMan and works like a charm.
Even it has the right locales, i18n module is taking always the default language translation file. Does someone know what could be happening?
Regards
I suppose it was due my local environment locales config(Ubuntu 18.10), given when I deployed to the VPS it worked like a charm.
Thanks anyway ;)

Whats is Production enviroment in Laravel?

I am curious to know what the APP_ENV entry is used for in Laravel environment files. Is it just for my own usage so I can detect it in code? If I create a fresh Laravel app and change APP_ENV to production what will it change under the hood? Nothing?
Thanks!
Typically you would have a different .env file on each server. It is up to you if you would like different parts of your app to work differently in different environments. The .env file is usually used so that your code can just grab values with the env helper function. This way when you change environments like switching from a test API key to a live API key for example, you can just edit the .env file and not touch the rest of your code.
https://laravel.com/docs/5.5/configuration#environment-configuration

How to customize validation messages in Laravel?

I searched a lot before asking this question but found nothing to help me.
I started using Laravel as a PHP framework. As I started to do form validation, I used the Validator class to manage all my validation and error messages. But I'd like to know how I can customize the error messages (I'd like to put them in another language for example).
The documentation says:
Language strings are stored in files within the resources/lang directory. Within this directory there should be a subdirectory for each language supported by the application.
Just create a directory with the supported language code, and add a validation.php file (it is wise to just copy the one provided in English then start translating).
An example for Spanish translation would be created at resources/lang/es/validation.php. And it will look as follow:
<?php
return array(
"required" => "El campo :attribute es requerido.",
);
After that, you will need to change the default language.
The default language for your application is stored in the app/config/app.php configuration file. You may change the active language at any time using the App::setLocale method.
Example of changing the default language at runtime:
App::setLocale('es');
in laravel 5 the validation.php file comes under the folder resources.
resources/lang/en/validation.php

Manual Url Culture Rewriting in DotNetNuke Request

I'm working with dotnetnuke 7.
I'm not using any rewriting modules and don't want to use them.
When content localization is enabled, url has the following view:
my_training_host/en-us/my-page.aspx
I want to change manually the display url so, that instead of full culture in query, the two letter culture (neutral culture) will show:
my_training_host/en/my-page.aspx
Does anyone have similar problem ?
If you ever change your mind about using a rewriting module, UrlMaster is the module for that. If not, then DNN 7.1 now adds support for creating url providers as extensions. More details at http://www.dnnsoftware.com/blog/cid/154604/Introducing-DNN-Extension-URL-Providers
I am using Open URL Rewriter for DNN - it does exactly what you ask for with it's default installation - no further config required.
And it's open source in comparison with UrlMaster.
In case of you use version 1.3.1 of Open URL Rewriter with DNN 7.04 to get two letters only for multilingual sites you have to make sure:
you create site aliases for each language with the two letter part you desire and
enable those entries as primary aliases (you need one primary alias for each language), for example for two languages (en & fr) you need to set three primary aliases like the following:
✔ www.yourdomain.com
✔ www.yourdomain.com/en us-US
✔ www.yourdomain.com/fr fr-FR

Resources