method getNumOptions documentation in bbn\Appui\I18n

get the num of items['text'] in original language and num translations foreach lang in configured langs (for this project uses all primaries as configured langs)

function() { /** @var $paths takes all options with i18n property setted*/ $paths = $this->options->findI18n(); $data = []; /** * creates the property data_widget that will have just num of items found for the option + 1 (the text of the option parent), the * * number of strings translated and the source language indexed to the language */ $primaries = $this->getPrimariesLangs(); foreach ($primaries as $p){ $configured_langs[] = $p['code']; } foreach ($paths as $p => $val){ $parent = $this->options->getIdParent($paths[$p]['id']); foreach ($configured_langs as $lang) { $count = 0; $items = $paths[$p]['items']; /** push the text of the option into the array of strings */ $items[] = [ 'id' => $paths[$p]['id'], 'text' => $paths[$p]['text'], 'id_parent' => $parent ]; foreach ($items as $idx => $item){ if ($id = $this->db->selectOne( 'bbn_i18n', 'id', [ 'exp' => $item['text'], 'lang' => $paths[$p]['language'] ] ) ) { if ($this->db->selectOne( 'bbn_i18n_exp', 'id_exp', [ 'id_exp' => $id, 'lang' => $lang ] ) ) { $count ++; } } } $paths[$p]['data_widget']['result'][$lang] = [ 'num' => count($items), 'num_translations' => $count, 'lang' => $lang ]; } $paths[$p]['data_widget']['locale_dirs'] = []; unset($paths[$p]['items']); $data[] = $paths[$p]; } return [ 'data' => $data ]; }

get the num of items['text'] in original language and num translations foreach lang in configured langs (for this project uses all primaries as configured langs) BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.