Skip to content

I18N module for ZF2 applications providing route and region, country and language lists in all languages

License

Notifications You must be signed in to change notification settings

zooxsmart/los-i18n

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LosI18n

Introduction

This middleware provides list of Languages, Countries and Regions translated to all languages.

Requirements

PHP 7.4 | 8.0 and any container-interopt compatible project.

Installation

composer require zooxsmart/los-i18n

Optionally, copy the config file to your project.

I18n Data

This module needs data from los-i18n-data. So you need either to add the module to you project:

Adding the los-i18n-data

composer require zooxsmart/los-i18n-data

File format

There are 3 formats: php, json and csv. If you need to import the json file, it's located: vendor/zooxsmart/los-i18n-data/data//languages.json vendor/zooxsmart/los-i18n-data/data//countries.json vendor/zooxsmart/los-i18n-data/data//regions.json

Usage

Language list

$languagesService = $sm->get('losi18n-countries');
// All languages translated to pt_BR
$languages = $countriesService->getAllLanguages('pt_BR');
// All languages in their native names
$languages = $countriesService->getNativeLanguages();
// Brazilian Portuguese in English
$language = $countriesService->getLanguage('pt_BR', 'en);

Country list

$countriesService = $sm->get('losi18n-countries');
// All officially assigned countries translated to English
$countries = $countriesService->getAllCountries('en');
// All countries translated to English
$countries = $countriesService->getAllCountries('en', false);
// United States translated to Brazilian Portuguese
$country = $countriesService->getCountry('US','pt_BR');

Region list

$regionsService = $sm->get('losi18n-regions');
$regions = $countriesService->getAllRegions('pt_BR');

About

I18N module for ZF2 applications providing route and region, country and language lists in all languages

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%