src/Common/Traits/Model/Localised.php
protected function addLocaleToResource(Resource $oResource): void
    {
        /** @var Locale $oLocale */
        $oLocale = Factory::service('Locale');

        //  Add the locale for _this_ item
        $oResource->locale = $this->getLocale(
            $oResource->{static::$sColumnLanguage},
            $oResource->{static::$sColumnRegion}
        );

        //  Set the locales for all _available_ items
        $oResource->available_locales = array_map(function ($sLocale) use ($oLocale) {
            list($sLanguage, $sRegion) = $oLocale::parseLocaleString($sLocale);
            return $this->getLocale($sLanguage, $sRegion);
        }, explode(',', $oResource->available_locales));

        //  Specify which locales are missing
        $oResource->missing_locales = array_diff(
            $oLocale->getSupportedLocales(),
            $oResource->available_locales
        );

        //  Remove internal fields
        unset($oResource->{static::$sColumnLanguage});
        unset($oResource->{static::$sColumnRegion});
    }
protected function addLocaleToResource(Resource $oResource): void
    {
        /** @var Locale $oLocale */
        $oLocale = Factory::service('Locale');

        //  Add the locale for _this_ item
        $oResource->locale = $this->getLocale(
            $oResource->{static::$sColumnLanguage},
            $oResource->{static::$sColumnRegion}
        );

        //  Set the locales for all _available_ items
        $oResource->available_locales = array_map(function ($sLocale) use ($oLocale) {
            list($sLanguage, $sRegion) = $oLocale::parseLocaleString($sLocale);
            return $this->getLocale($sLanguage, $sRegion);
        }, explode(',', $oResource->available_locales));

        //  Specify which locales are missing
        $oResource->missing_locales = array_diff(
            $oLocale->getSupportedLocales(),
            $oResource->available_locales
        );

        //  Remove internal fields
        unset($oResource->{static::$sColumnLanguage});
        unset($oResource->{static::$sColumnRegion});
    }
protected function addLocaleToResource ( Resource $ oResource ) : void { /** @var Locale $oLocale */ $ oLocale = Factory :: service ( 'Locale' ) ; //  Add the locale for _this_ item $ oResource -> locale = $ this -> getLocale ( $ oResource -> { static :: $ sColumnLanguage } , $ oResource -> { static :: $ sColumnRegion } ) ; //  Set the locales for all _available_ items $ oResource -> available_locales = array_map ( function ( $ sLocale ) use ( $ oLocale ) { list ( $ sLanguage , $ sRegion ) = $ oLocale :: parseLocaleString ( $ sLocale ) ; return $ this -> getLocale ( $ sLanguage , $ sRegion ) ; } , explode ( ',' , $ oResource -> available_locales ) ) ; //  Specify which locales are missing $ oResource -> missing_locales = array_diff ( $ oLocale -> getSupportedLocales ( ) , $ oResource -> available_locales ) ; //  Remove internal fields unset ( $ oResource -> { static :: $ sColumnLanguage } ) ; unset ( $ oResource -> { static :: $ sColumnRegion } ) ; }
Adds a Locale object to a Resource, and removes the language and region properties

@param Resource $oResource The resource to modify

@throws FactoryException
Adds a Locale object to a Resource and removes the language and region properties