You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Prevent calling setCode if the code hasn’t changed.
- Added $checkDefault argument to the has method in the Localizer class.
- Code cleanup and minor tweaks across files.
Copy file name to clipboardExpand all lines: src/Localizer.php
+24-75Lines changed: 24 additions & 75 deletions
Original file line number
Diff line number
Diff line change
@@ -20,11 +20,8 @@ class Localizer implements LocalizerInterface
20
20
21
21
/**
22
22
* Default translation that can be a string or another localizer.
23
-
* If the key is not found in the translation, the default will be used.
24
-
* If the default is a string, the string itself will be returned instead of the default translation,
25
-
* but if it's a localizer object, it's `get` method will be used to retrieve the translation.
26
-
* @see self::get()
27
23
* @var Localizer|string
24
+
* @see self::get()
28
25
*/
29
26
protected$defaultTranslation;
30
27
@@ -34,30 +31,24 @@ class Localizer implements LocalizerInterface
34
31
*/
35
32
protectedarray$translators = [];
36
33
37
-
/**
38
-
* Retrieves the root path.
39
-
*/
40
34
publicfunctiongetPath(): string
41
35
{
42
36
return$this->path;
43
37
}
44
38
45
-
/**
46
-
* Retrieves the current language code.
47
-
*/
48
39
publicfunctiongetCode(): string
49
40
{
50
41
return$this->code;
51
42
}
52
43
53
-
/**
54
-
* Changes the localization code.
55
-
* @param string $code New code.
56
-
* @param bool $refresh Optional. After changing the code, should it reload the loaded translators or remove all of them from the loaded state? Default false.
* It's's similar to the {@see self::get()} method, with the difference that if the output is an array, it randomly returns one of the values within it.
* It's's similar to the {@see self::get()} method, with the difference that if the output is an array, it randomly returns one of the values within it.
106
+
* It's similar to the {@see self::get()} method, with the difference that if the output is an array, it randomly returns one of the values within it.
0 commit comments