Skip to content

Conversation

JulianGlueck
Copy link

This PR allows developers to obtain localisation information of the application and the system via the App facade.

It adds three new methods to the facade that are proxies for the Electron methods app.getLocale(), app.getLocaleCountryCode(), and app.getSystemLocale() (see details on the Electron documentation). This allows developers to improve the localisation of their application, e.g. by automatically setting or suggesting a language that matches the system language when a NativePHP application is first launched.

Electron PR: NativePHP/electron#247
Laravel PR: NativePHP/laravel#681

If there's anything you'd like me to tweak or improve in this PR, please let me know. 😊

Comment on lines 79 to 81
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)

Copy link
Member

@SRWieZ SRWieZ left a comment

Choose a reason for hiding this comment

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

The only change I would suggest is to include an example after each line instead of explaining it below. Additionally, it would be helpful to elaborate on the difference between app local and system local, providing an example of where users can change this on Windows and/or Mac.

@JulianGlueck
Copy link
Author

Sorry @SRWieZ, it took a while, but I wanted to check the returned values both under macOS and Windows.
I've updated the section based on the outcome of my tests and also added some additional information based on Electrons documentation (1, 2, 3).

I have also added two external links which I believe to be helpful - is this ok?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants