/** * @dataProvider getSupportedLocalesDP */ public function testGetSupportedLocales($a, $b, $c, $d) { $obj = new _Project(); $this->array($obj->getSupportedLocales($a, $b, $c))->isEqualTo($d); }
echo "</ul>\n"; } else { // I have a string_id to display, identify the reference string from provided hash $reference_string = ''; foreach ($reference_data['strings'] as $current_string => $value) { if ($string_id == sha1($current_string)) { $reference_string = $current_string; break; } } if ($reference_string == '') { // String not found, throw error http_response_code(400); die("No string available with id: {$string_id}."); } $supported_locales = Project::getSupportedLocales($current_website, $current_filename, $langfiles_subsets); $json_data[$string_id][$reference_locale] = $reference_string; foreach ($supported_locales as $current_locale) { if (!file_exists(Project::getLocalFilePath($current_website, $current_locale, $current_filename))) { // If the .lang file does not exist, just skip the locale for this file continue; } $locale_data = LangManager::loadSource($current_website, $current_locale, $current_filename); // Add string to Json only if localized if (LangManager::isStringLocalized($reference_string, $locale_data, $reference_data)) { $json_data[$string_id][$current_locale] = Utils::cleanString($locale_data['strings'][$reference_string]); } } if (isset($_GET['plaintext'])) { header("Content-type: text/plain; charset=utf-8"); foreach ($json_data[$string_id] as $key => $value) {
<?php namespace Langchecker; use Transvision\Json; $output_array = []; $lang_based_sites = Project::getWebsitesByDataType($sites, 'lang'); if ($website != '' && $filename != '') { if (isset($lang_based_sites[$website])) { $current_website = $lang_based_sites[$website]; $current_filename = $filename; if (in_array($current_filename, Project::getWebsiteFiles($current_website))) { $output_array = array_values(Project::getSupportedLocales($current_website, $current_filename, $langfiles_subsets)); } } } elseif ($project != '') { switch ($project) { case 'locamotion': $output_array = $locamotion_locales; break; case 'marketplacebadge': $output_array = $marketplacebadge_locales; break; case 'slogans': $output_array = $slogans_locales; break; case 'snippets': $output_array = $snippets_locales; break; case 'snippets_main': $output_array = $snippets_main_locales;