Review main Merged

77470[FEATURE] Add all countries and their localized names

Benni Mack CR +2 V +2 Impossible +90225 −1 updated 01/19/23, 11:12

Commit message

TYPO3 now supports loading a list of all
countries of the world in all supported
translations that TYPO3 has to offer - out of the box.

For this, a dev-dependency "sokil/php-isocodes-db-i18n"
package is used, which contains a list of
all countries (ISO 3166-1), their short names,
their official names in english, and optional
translations.

This package fetches the data from debian
repositories and is updated automatically
on the second day of each month.

A new Build script then transfers the information
and the translations (originally in PO files)
via symfony/translation into a PHP class
and XLF translations for country names ("France") and
official country names ("French Republic").

The Build script is already prepared
to also fetch language script codes in the future,
along with languages and/or currencies as well.

A new API (CountryProvider) is available
which returns the countries, and prepared
label strings to be used with TYPO3's language
mechanism.

A ViewHelper <f:form.countrySelect>
is added which can be used in Fluid templates.

Example:
  <f:form.countrySelect name="country" value="DE" sortByOptionLabel="true" prioritizedCountries="{0: 'DE', 1: 'AT', 2: 'CH'}"/>

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Stefan Bürk +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 66

Show 46 more files

Review log 2739

Show 914 earlier messages
  1. Benni Mack uploaded patch set 1 01/18/23, 12:36

  2. core-ci voted on patch set 1 V -1 01/18/23, 12:44 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36086

  3. Benni Mack uploaded patch set 2 V -1 01/18/23, 12:55

  4. core-ci voted on patch set 2 V +1 01/18/23, 13:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36089

  5. Benni Mack uploaded patch set 3 V +1 01/18/23, 15:27

  6. core-ci voted on patch set 3 V +1 01/18/23, 15:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36109

  7. Benni Mack uploaded patch set 4 V +1 01/18/23, 15:41

  8. core-ci voted on patch set 4 V +1 01/18/23, 15:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36113

  9. Benni Mack uploaded patch set 5 V +1 01/18/23, 16:49

  10. core-ci voted on patch set 5 V +1 01/18/23, 16:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36128

  11. Susi Moog commented on patch set 5 01/18/23, 17:33

    Services.yaml:395

    true is default?
  12. Oliver Hader voted on patch set 5 CR +1 01/18/23, 17:35

  13. Benni Mack uploaded patch set 6 CR +1 V +1 01/18/23, 17:39

  14. Susi Moog voted on patch set 6 CR +1 01/18/23, 17:43

  1. core-ci voted on patch set 6 V +1 01/18/23, 17:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36135

  2. Georg Ringer commented on patch set 6 01/18/23, 17:55

    CountryProvider.php:23

    is this really a database? what about "local copy of https://github url?

    CountryProvider.php:64

    getAll

    CountryProvider.php:69

    getByIsoCode2 + getByIsoCode3 as another getter

    CountrySelectViewHelper.php:115

    make it explicit. I suggest an exception with a message including all options

    CountrySelectViewHelper.php:144

    without testing: do we have a problem with fallbacks if no translation is available? should we return the LocalizationUtility::translate($label); then?
  3. Susi Moog voted on patch set 6 V +1 01/18/23, 17:56

  4. Benni Mack uploaded patch set 7 CR +1 V +1 01/18/23, 19:29

  5. core-ci voted on patch set 7 V +1 01/18/23, 19:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36143

  6. Jasmina Ließmann uploaded patch set 8 V +1 01/18/23, 19:54

  7. Jasmina Ließmann uploaded patch set 9 01/18/23, 19:58

  8. core-ci voted on patch set 8 V +1 01/18/23, 20:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36145

  9. core-ci voted on patch set 9 V +1 01/18/23, 20:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36146

  10. Benni Mack commented on patch set 9 01/18/23, 20:49

    CountryProvider.php:64 Reply

    Done

    Services.yaml:395 Reply

    Done

    CountrySelectViewHelper.php:115 Reply

    will do

    CountrySelectViewHelper.php:144 Reply

    adapted and covered with tests.
  11. Jasmina Ließmann voted on patch set 9 V +1 01/18/23, 20:52

  12. Benni Mack uploaded patch set 10 V +1 01/18/23, 21:19

  13. Benni Mack commented on patch set 10 01/18/23, 21:20

    CountryProvider.php:23 Reply

    Done

    CountryProvider.php:69 Reply

    Done

    CountrySelectViewHelper.php:115 Reply

    Done
  14. core-ci voted on patch set 10 V +1 01/18/23, 21:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36153

  15. Oliver Hader commented on patch set 10 01/18/23, 21:41

    CountryProvider.php:38

    Seems always to be empty...
  16. Stefan Bürk commented on patch set 10 01/18/23, 23:46

    Nice feature, thanks for the patch. Wouldn't it be better to write the prepared country file as PHP file returning an array instead of a json file which needs to be json_decoded() in the classes ? (by the build script). That would take PHP opcode cache into account - and on updates it maybe better regonizable what have changed in the build file for review ... Just putting to discussion, maybe it has been decided already. Or I'm missing something ?

    CountryProvider.php:50

    Maybe we should use here ``` $data = json_decode(json: $content, flags: JSON_OBJECT_AS_ARRAY | JSON_THROW_ON_ERROR); ``` and either let eventual exceptions bubbles up - or catch and react on it in case decoding fails.
  17. Benni Mack uploaded patch set 11 V +1 01/19/23, 09:49

  18. Benni Mack commented on patch set 11 01/19/23, 09:49

    Reply

    Done
    thanks for the input!

    CountryProvider.php:38 Reply

    Done

    CountryProvider.php:50 Reply

    Done
  19. core-ci voted on patch set 11 V +1 01/19/23, 10:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36177

  20. Stefan Bürk commented on patch set 11 CR -1 01/19/23, 10:11

    on it ...
  21. Stefan Bürk uploaded patch set 12 CR -1 V +1 01/19/23, 10:21

  22. core-ci voted on patch set 12 V +1 01/19/23, 10:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36183

  23. Stefan Bürk voted on patch set 12 V +1 CR +1 01/19/23, 11:02

  24. Georg Ringer voted on patch set 12 V +2 CR +2 01/19/23, 11:12

  25. Georg Ringer merged patch set 13 01/19/23, 11:12