Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3.2.2 #71

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
14 changes: 14 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
* text=auto

*.md diff=markdown
*.php diff=php

/.github export-ignore
/tests export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.styleci.yml export-ignore
CHANGELOG.md export-ignore
LICENSE.md export-ignore
phpunit.xml.dist export-ignore
41 changes: 41 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: run-tests

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-20.04
strategy:
fail-fast: true
matrix:
php: [ 7.1, 7.4 ]
laravel: [ 5.* ]
include:
- laravel: 5.*

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer update --prefer-dist --no-interaction --no-progress

- name: Execute tests
run: vendor/bin/phpunit
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/vendor/
.idea
/vendor
composer.lock
/phpunit.xml
.phpunit.result.cache
5 changes: 5 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
preset: laravel
enabled:
- concat_with_spaces
disabled:
- concat_without_spaces
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

161 changes: 161 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Changelog

All notable changes to `pod-point/countries` will be documented in this file.

## 3.2.2 - 2024-05-23

* Adds Spain and France as locales for present and future expansion (target 3.2 base for API3)

## 3.2.0 - 2022-04-29

* Adds precision to the `NumberHelper` and implements `NumberHelper` Facade ([#57](https://github.com/Pod-Point/countries/pull/57)).


## 3.1.4 - 2022-04-13

* Fix the memoization and the `getSymbol` method in the CurrencyHelper ([#51](https://github.com/Pod-Point/countries/pull/51)).

## 3.1.3 - 2021-05-19

* [SWP-2788](https://podpoint.atlassian.net/browse/SWP-2788) Introduce memoization for efficiency during use on mass
* Introduced a history for finds in the `CountryHelper` so that we don't perform the same lookup many times
* Introduced a caching layer for `NumberFormatters` used in the `CurrencyHelper` to avoid creating many unnecessary instances when used on mass

## 3.1.2 - 2021-05-18

* Minor modernisations
* Moved from Travis CI to Github Actions

## 3.1.1 - 2020-11-05

* `getSystemLocale` in `LocalizedHelper` now returns the fallback locale if the given one is not found. This created issues with some tests because NumberFormatter becomes system dependent if null is given.

## 3.1.0 - 2020-11-03

* Add `CountryHelper` facade with `getCountryCodeFromLocale` and `findByLocale` functions.
* Improve `CurrencyHelper` facade with a new function `toStandardFormat`. It returns the typical currency format and can also show a specified number of decimals.

## 3.0.9 - 2020-10-12

* Add `formatToMinorUnitWhenApplicable` method: formats currency with pence when the rate is less than 1.00.

## 3.0.8 - 2020-07-01

* [SWP-1718](https://podpoint.atlassian.net/browse/SWP-1718) - Revert “Republic of Ireland” to have its locale set to ie instead of en

## 3.0.7 - 2020-06-09

### [SWP-1648] DT breaking change on i18n v 3.0.6

* Fix locale for supported countries (should only be `en` or `no` for now)
* Renaming wrongly named test files.
* Improve test coverage.
* Improve ViewComposer tests.

### [SWP-1609] [ALT] Extract VAT logic into i18n package

* Leverage `mpociot/vat-calculator` in order to bring VAT resolution support
* Exposing it through a Facade too
* Improve service provider
* Better type hinting
* Update readme

## 3.0.6 - 2020-04-21

* Update Ireland details
* Add EUR as currency code
* IE as country code

## 3.0.5 - 2019-07-08

* Reverting the order when merging countries so that the name in our config is the one that is going to be used.

## 3.0.4 - 2019-07-04

### CurrencyHelper: up to 6 decimals of a monetary unit supported

* PHP NumberFormatter will round up with 2 decimals only by default.
* Sometimes we can display up to 6 decimals of the monetary unit (ex: `£0.106544`) especially for energy prices like `£0.106544 per kWh`.
* If a regular float like `19.99` with only 2 decimals is given, it will still be formatted as usual `£19.99`.

## 3.0.3 - 2019-06-26

* [SWP-36](https://podpoint.atlassian.net/browse/SWP-36) Adding to format from cents helper method with the new `toFormatFromInt` and `moneyFormatFromInt` helpers method.

## 3.0.2 - 2019-05-22

* Adding new abstract `LocalizedHelper` that will have the logic to retrieve a locale in a `NumberFormatter` format
* Changing the currency helper so that it extends the localized helper
* Adding new number helper that allows us to format a number in the right locale
* renaming `format` to `toFormat` for consistency in the `NumberHelper`
* Changing the style from `DECIMAL` to `DEFAULT_STYLE`

## 3.0.0 - 2019-03-14

### Added

* Support of currency conversion service
* Helpers to format money given the currency and locale
* Helper to get the currency symbol given the currency code and locale

### Updated

* Namespace was update to `PodPoint\I18n`

## 2.4.4 - 2018-09-12

* Add GB system locale

## 2.4.3 - 2018-09-04

* Add Norway and UK timezones

## 2.4.2 - 2018-02-21

* Add system locale to NO

## 2.4.1 - 2018-02-15

* Added country helper

## 2.4.0 - 2018-02-01

* Add ISO country information to existing country config

## 2.3.2 - 2018-01-26

* Adding the extension linked to the countries in `countries-partial` config files
* Renaming the index 'extension' to 'tld'

## 2.3.1/2.3.0 - 2018-01-23

* Adding locale informations in config file `contries-partials.php`, and a new view composer that prepares values for language switchers
* Adding language field into configuration files for the languages switchers

## 2.2.0 - 2018-01-19

* Add country code constants

## 2.1.0 - 2017-10-23

* Add country code view composer

## 2.0.1 - 2017-09-01

* Fix to country with no dialling code: `null` value where no dialling code

## 2.0 - 2017-08-31

* Added dialling codes

#### Breaking changes:

* This is a breaking change from v1.0.* as config arrays have been restructured to include dialling codes.

## 1.0.1 - 2015-12-07

* Support Laravel 5.1 and 5.2

## 1.0.0 - 2015-09-07

* Initial release
38 changes: 19 additions & 19 deletions LICENCE.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
MIT License
# The MIT License (MIT)

Copyright (c) 2019 POD Point Ltd
Copyright (c) Pod Point <software@pod-point.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
39 changes: 32 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Internationalisation Package

[![Build Status](https://travis-ci.org/Pod-Point/countries.svg?branch=master)](https://travis-ci.org/Pod-Point/countries) [![codecov](https://codecov.io/gh/Pod-Point/countries/branch/master/graph/badge.svg?token=kG5ptGaEFs)](https://codecov.io/gh/Pod-Point/countries) [![Packagist](https://img.shields.io/packagist/v/Pod-Point/countries.svg)](https://packagist.org/packages/pod-point/countries)
[![run-tests](https://github.com/Pod-Point/countries/actions/workflows/run-tests.yml/badge.svg)](https://github.com/Pod-Point/countries/actions/workflows/run-tests.yml)

This package provides Laravel and Lumen applications internationalisation features:

Expand All @@ -14,15 +14,24 @@ The countries are indexed using their uppercase ISO codes (alpha2/cca2).

## Installation

Require the package in composer:
You can install the package via composer:

```javascript
"require": {
"pod-point/countries": "^3.0"
},
For Laravel 5.x and PHP <= 7.1
```bash
composer require pod-point/countries:^3.0
```

Then finally, if you're using Laravel, add the service provider to your `config/app.php` providers array:
For Laravel 6.x and PHP >= 7.2
```bash
composer require pod-point/countries:^4.0
```

For Laravel 7.x or 8.x and PHP >= 7.3
```bash
composer require pod-point/countries:^5.0
```

Then, finally, if you're using a Laravel version which doesn't support Auto Discovery, add the service provider to your `config/app.php` providers array:

```php
'providers' => [
Expand All @@ -35,3 +44,19 @@ If you're using Lumen, add the following line to your `bootstrap/app.php` file:
```php
$app->register(PodPoint\I18n\Providers\CountriesServiceProvider::class);
```

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## Licence

The MIT Licence (MIT). Please see [Licence File](LICENCE.md) for more information.

---

<img src="https://d3h256n3bzippp.cloudfront.net/pod-point-logo.svg" align="right" />

Travel shouldn't damage the earth 🌍

Made with ❤️&nbsp;&nbsp;at [Pod Point](https://pod-point.com)
Loading
Loading