-
Notifications
You must be signed in to change notification settings - Fork 506
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3873 from ushahidi/develop
Freeze v4.4.0
- Loading branch information
Showing
175 changed files
with
2,313 additions
and
1,596 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
; recommended pull command | ||
; | ||
; tx pull -a --minimum-perc 1 --mode onlytranslated | ||
; | ||
|
||
[main] | ||
host = https://www.transifex.com | ||
|
||
[ushahidi-v3-api.configphp] | ||
file_filter = resources/lang/<lang>/config.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
||
[ushahidi-v3-api.contactsphp] | ||
file_filter = resources/lang/<lang>/contacts.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
||
[ushahidi-v3-api.csvphp] | ||
file_filter = resources/lang/<lang>/csv.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
||
[ushahidi-v3-api.exportphp] | ||
file_filter = resources/lang/<lang>/export.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
||
[ushahidi-v3-api.form_attributephp] | ||
file_filter = resources/lang/<lang>/form_attribute.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
||
[ushahidi-v3-api.form_contactphp] | ||
file_filter = resources/lang/<lang>/form_contact.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
||
[ushahidi-v3-api.formphp] | ||
file_filter = resources/lang/<lang>/form.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
||
[ushahidi-v3-api.form_rolephp] | ||
file_filter = resources/lang/<lang>/form_role.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
||
[ushahidi-v3-api.hxl_metadataphp] | ||
file_filter = resources/lang/<lang>/hxl_metadata.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
||
[ushahidi-v3-api.layersphp] | ||
file_filter = resources/lang/<lang>/layers.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
||
[ushahidi-v3-api.mediaphp] | ||
file_filter = resources/lang/<lang>/media.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
||
[ushahidi-v3-api.messagephp] | ||
file_filter = resources/lang/<lang>/message.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
||
[ushahidi-v3-api.notificationsphp] | ||
file_filter = resources/lang/<lang>/notifications.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
||
[ushahidi-v3-api.postphp] | ||
file_filter = resources/lang/<lang>/post.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
||
[ushahidi-v3-api.rolephp] | ||
file_filter = resources/lang/<lang>/role.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
||
[ushahidi-v3-api.tagphp] | ||
file_filter = resources/lang/<lang>/tag.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
||
[ushahidi-v3-api.userphp] | ||
file_filter = resources/lang/<lang>/user.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
||
[ushahidi-v3-api.user_settingphp] | ||
file_filter = resources/lang/<lang>/user_setting.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
||
[ushahidi-v3-api.validationphp] | ||
file_filter = resources/lang/<lang>/validation.php | ||
source_lang = en | ||
type = PHP_ARRAY | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM ushahidi/php-fpm-nginx:php-7.1 | ||
FROM ushahidi/php-fpm-nginx:php-7.2 | ||
|
||
WORKDIR /var/www | ||
COPY composer.json ./ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
namespace Ushahidi\App\Http\Middleware; | ||
|
||
use Closure; | ||
use \Negotiation\LanguageNegotiator; | ||
|
||
class SetLocale | ||
{ | ||
/** | ||
* Handle an incoming request. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Closure $next | ||
* @param mixed ...$features | ||
* @return mixed | ||
*/ | ||
public function handle($request, Closure $next, ...$features) | ||
{ | ||
$langHeader = $request->header('Accept-language'); | ||
if ($langHeader) { | ||
$negotiator = new LanguageNegotiator(); | ||
$priorities = config('language.locales'); | ||
|
||
/** | ||
* NOTE: the negotiation library does not support providing a list of ordered elements in its | ||
* stable version so defaulting to english is the best we can do right now without a more complex | ||
* custom class. I'd rather we support the willduran/negotiation library if we go down that path. | ||
*/ | ||
$type = $fallback = $this->getPriorityFallback($langHeader, $priorities, 'en'); | ||
/** | ||
* TODO: | ||
* decide if we would like to work on extending willduran/negotiation and bring | ||
* v3.0.3 to stable so that we have getOrderedElements available if it's still | ||
* being maintained (or I guess fork if it is no longer mantained) | ||
*/ | ||
$bestLanguage = $negotiator->getBest($langHeader, $priorities); | ||
if ($bestLanguage) { | ||
$type = $bestLanguage->getType(); | ||
} | ||
app('translator')->setLocale($type); | ||
app('translator')->setFallback($fallback); | ||
} | ||
|
||
return $next($request); | ||
} | ||
/** | ||
* Find a secondary language as fallback within our list of available lang codes without region | ||
* or use the default ('en' normally) if none is available. | ||
* When we migrate to v3 of negotiation package we can just use the orderedElements function | ||
* and take q=0.x into account easily. | ||
*/ | ||
private function getPriorityFallback($languageCode, $locales, $default) | ||
{ | ||
$decision = $default; | ||
$splitLangCode = substr($languageCode, 0, 2); | ||
if (array_search($splitLangCode, $locales) > -1) { | ||
$decision = $splitLangCode; | ||
} | ||
return $decision; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.