Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions resources/views/docs/desktop/1/the-basics/application.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@ To get the current app version, use the `version` method. The version is defined
$version = App::version();
```

### Locale information

The facade offers several methods for accessing some of the system's localisation information.
This data can be helpful for localising your application, e.g. if you want to suggest the corresponding language to the user on first launch.

```php
App::getLocale();
App::getLocaleCountryCode();
App::getSystemLocale();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
App::getLocale();
App::getLocaleCountryCode();
App::getSystemLocale();
App::getLocale(); // fr_FR
App::getLocaleCountryCode(); // fr
App::getSystemLocale(); // fr_FR.UTF-8

Can we add an example output? (I don't know if my comments are correct)

```

The `getLocale` method will return the full locale string used by the app. This includes both the language and the country or region.
`getLocaleCountryCode` returns only the country code part of the locale.
With `getSystemLocale` you can access the system-wide locale setting. This is the locale set at the operating system level, not necessarily what the app is using.


### App Badge Count
_Only available on macOS and Linux_

Expand Down