Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7357acd

Browse files
committed
Merge branch 'release-0.5.0'
2 parents ddc7f55 + b27674f commit 7357acd

30 files changed

Lines changed: 513 additions & 170 deletions

.travis.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,28 @@ cache:
77

88
matrix:
99
include:
10-
- php: 5.6
10+
- php: 7.2
1111
env:
1212
- DEPENDENCIES="--prefer-stable"
13-
- php: 5.6
13+
- php: 7.2
1414
env:
1515
- DEPENDENCIES="--prefer-lowest --prefer-stable"
16-
- php: 7.0
16+
17+
- php: 7.3
1718
env:
1819
- DEPENDENCIES="--prefer-stable"
19-
- php: 7.0
20+
- php: 7.3
2021
env:
2122
- DEPENDENCIES="--prefer-lowest --prefer-stable"
22-
- php: 7.1
23+
24+
- php: 7.4
2325
env:
2426
- DEPENDENCIES="--prefer-stable"
2527
- TEST_COVERAGE=true
26-
- php: 7.1
28+
- php: 7.4
2729
env:
2830
- DEPENDENCIES="--prefer-lowest --prefer-stable"
2931

30-
3132
before_script:
3233
- phpenv config-rm xdebug.ini
3334
- composer self-update

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ Changelog
44
v1.0.0 - TBD
55
---
66

7+
v0.5.0 - 2020-09-09
8+
---
9+
* [#104](https://github.com/basz/SlmLocale/pull/104) Run tests for php 7.2 and 7.3
10+
* [#106](https://github.com/basz/SlmLocale/pull/106) Added a view-helper to get the primary-language
11+
* [#105](https://github.com/basz/SlmLocale/pull/105) Fixed locale url change, from default locale to other locale
12+
* [#107](https://github.com/basz/SlmLocale/pull/107) Added Laminas support
13+
* [#108](https://github.com/basz/SlmLocale/pull/108) Added tests for php74
14+
715
v0.4.1
816
---
917
* [#99](https://github.com/basz/SlmLocale/pull/99) fixed #26 unit testing applications using SlmLocale
@@ -34,4 +42,4 @@ First public stable release
3442
* Rewrite of internal detector events
3543
* Update of all available strategies
3644
* Compliant with coding standards
37-
* All covered with unit tests
45+
* All covered with unit tests

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Created by Jurian Sluiman
88

99
Introduction
1010
------------
11-
SlmLocale is a Zend Framework module to automatically detect a locale for your
11+
SlmLocale is a Laminas module to automatically detect a locale for your
1212
application. It uses a variety of pluggable strategies to search for a valid
1313
locale. SlmLocale features a default locale, a set of supported locales and
1414
locale aliases.
@@ -96,7 +96,7 @@ is important! You usually want the `acceptlanguage` as last for a fallback:
9696

9797
At this moment, the locale should be detected. The locale is stored inside php's
9898
`Locale` object. Retrieve the locale with `Locale::getDefault()`. This is also
99-
automated inside Zend Framework translator objects and i18n view helpers (so
99+
automated inside Laminas translator objects and i18n view helpers (so
100100
you do not need to set the locale yourself there).
101101

102102
### Set the locale's language in html
@@ -110,7 +110,7 @@ in the `html` tag:
110110
Inject the detected language here with the following code:
111111

112112
```
113-
<html lang="<?= Locale::getPrimaryLanguage(Locale::getDefault())?>">
113+
<html lang="<?= $this->primaryLanguage()?>">
114114
```
115115

116116
### Disable UriPathStrategy in PHPUNIT

composer.json

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "slm/locale",
3-
"description": "Automatic detection of locales for Zend Framework",
3+
"description": "Automatic detection of locales for Laminas",
44
"type": "library",
55
"license": "BSD-3-Clause",
66
"keywords": [
7+
"laminas",
78
"zf",
89
"zend framework",
910
"i18n",
@@ -18,26 +19,26 @@
1819
}
1920
],
2021
"require": {
21-
"php": "^5.6 || ^7.0",
22+
"php": "^7.2",
2223
"ext-intl": "*",
23-
"zendframework/zend-eventmanager": "^3.1",
24-
"zendframework/zend-http": "^2.7",
25-
"zendframework/zend-modulemanager": "^2.8.2",
26-
"zendframework/zend-router": "^3.0",
27-
"zendframework/zend-servicemanager": "^3.2",
28-
"zendframework/zend-stdlib": "^3.1",
29-
"zendframework/zend-view": "^2.9.0"
24+
"laminas/laminas-eventmanager": "^3.1",
25+
"laminas/laminas-http": "^2.7",
26+
"laminas/laminas-modulemanager": "^2.8.2",
27+
"laminas/laminas-router": "^3.0",
28+
"laminas/laminas-servicemanager": "^3.2",
29+
"laminas/laminas-stdlib": "^3.2.1",
30+
"laminas/laminas-view": "^2.9.0"
3031
},
3132
"require-dev": {
32-
"friendsofphp/php-cs-fixer": "^2.8.1",
33-
"phpunit/phpunit": "^4.8.36",
34-
"satooshi/php-coveralls": "^1.0.2",
35-
"zendframework/zend-console": "^2.6",
36-
"zendframework/zend-mvc": "^3.1",
37-
"zendframework/zend-mvc-console": "^1.1.9"
33+
"friendsofphp/php-cs-fixer": "^2.16.1",
34+
"phpunit/phpunit": "^8.5.1",
35+
"satooshi/php-coveralls": "^1.1.0",
36+
"laminas/laminas-console": "^2.6",
37+
"laminas/laminas-mvc": "^3.1",
38+
"laminas/laminas-mvc-console": "^1.1.9"
3839
},
3940
"suggest": {
40-
"zendframework/zend-mvc": "For using the router in the UriPath strategy"
41+
"laminas/laminas-mvc": "For using the router in the UriPath strategy"
4142
},
4243
"autoload": {
4344
"psr-4": {

config/module.config.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
<?php
22

33
use SlmLocale\Locale\Detector;
4-
use SlmLocale\Service\DetectorFactory;
5-
use SlmLocale\Service\LocaleMenuViewHelperFactory;
6-
use SlmLocale\Service\LocaleUrlViewHelperFactory;
4+
use SlmLocale\Service;
75
use SlmLocale\Strategy\Factory\StrategyPluginManagerFactory;
86
use SlmLocale\Strategy\StrategyPluginManager;
9-
use SlmLocale\View\Helper\LocaleMenu;
10-
use SlmLocale\View\Helper\LocaleUrl;
7+
use SlmLocale\View\Helper;
118

129
/**
1310
* Copyright (c) 2012-2013 Jurian Sluiman.
@@ -56,18 +53,20 @@
5653
'service_manager' => [
5754
'factories' => [
5855
StrategyPluginManager::class => StrategyPluginManagerFactory::class,
59-
Detector::class => DetectorFactory::class,
56+
Detector::class => Service\DetectorFactory::class,
6057
],
6158
],
6259

6360
'view_helpers' => [
6461
'aliases' => [
65-
'localeUrl' => LocaleUrl::class,
66-
'localeMenu' => LocaleMenu::class,
62+
'localeUrl' => Helper\LocaleUrl::class,
63+
'localeMenu' => Helper\LocaleMenu::class,
64+
'primaryLanguage' => Helper\PrimaryLanguage::class,
6765
],
6866
'factories' => [
69-
LocaleUrl::class => LocaleUrlViewHelperFactory::class,
70-
LocaleMenu::class => LocaleMenuViewHelperFactory::class,
67+
Helper\LocaleUrl::class => Service\LocaleUrlViewHelperFactory::class,
68+
Helper\LocaleMenu::class => Service\LocaleMenuViewHelperFactory::class,
69+
Helper\PrimaryLanguage::class => Service\PrimaryLanguageHelperFactory::class,
7170
],
7271
],
7372
];

docs/1.Introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Introduction
22
===
3-
SlmLocale is a Zend Framework module to automatically detect a locale for your application. It uses a variety of pluggable strategies to search for a valid locale. SlmLocale features a default locale, a set of supported locales and locale aliases.
3+
SlmLocale is a Laminas module to automatically detect a locale for your application. It uses a variety of pluggable strategies to search for a valid locale. SlmLocale features a default locale, a set of supported locales and locale aliases.
44

55
Strategies
66
---

docs/2.Strategies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Path segment of URI
2424
---
2525
The path segment uses the first part of the path which does not belong to the base path. This means if your site runs under http://example.com, then `/en-US/` selects the locale en-US. If your site runs under http://example.com/my-app/, then `/my-app/en-US/` selects the locale.
2626

27-
Furthermore, this strategy updates the router's base path with the locale appended. This means all links built with Zend\Navigation or with the `url()` view helper, will have the locale prepended automatically.
27+
Furthermore, this strategy updates the router's base path with the locale appended. This means all links built with Laminas\Navigation or with the `url()` view helper, will have the locale prepended automatically.
2828

2929
The strategy supports aliases, so you can use `en` as an alias for en-US and `nl` for nl-NL. However, a few bugs are still present at this moment so it is not advised to use these aliases together with this strategy.
3030

phpunit.xml.dist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@
44
<testsuite name="SlmLocale">
55
<directory>./tests</directory>
66
</testsuite>
7+
8+
<filter>
9+
<whitelist processUncoveredFilesFromWhitelist="true">
10+
<directory suffix=".php">src</directory>
11+
</whitelist>
12+
</filter>
713
</phpunit>

src/SlmLocale/Locale/Detector.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040

4141
namespace SlmLocale\Locale;
4242

43+
use Laminas\EventManager\EventManagerAwareInterface;
44+
use Laminas\EventManager\EventManagerInterface;
45+
use Laminas\Stdlib\RequestInterface;
46+
use Laminas\Stdlib\ResponseInterface;
47+
use Laminas\Uri\Uri;
4348
use SlmLocale\LocaleEvent;
4449
use SlmLocale\Strategy\StrategyInterface;
45-
use Zend\EventManager\EventManagerAwareInterface;
46-
use Zend\EventManager\EventManagerInterface;
47-
use Zend\Stdlib\RequestInterface;
48-
use Zend\Stdlib\ResponseInterface;
49-
use Zend\Uri\Uri;
5050

5151
class Detector implements EventManagerAwareInterface
5252
{

src/SlmLocale/LocaleEvent.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040

4141
namespace SlmLocale;
4242

43-
use Zend\EventManager\Event;
44-
use Zend\Stdlib\RequestInterface;
45-
use Zend\Stdlib\ResponseInterface;
46-
use Zend\Uri\Uri;
43+
use Laminas\EventManager\Event;
44+
use Laminas\Stdlib\RequestInterface;
45+
use Laminas\Stdlib\ResponseInterface;
46+
use Laminas\Uri\Uri;
4747

4848
class LocaleEvent extends Event
4949
{

0 commit comments

Comments
 (0)