コード例 #1
0
ファイル: Strings.php プロジェクト: lester-shu/transvision
 /**
  * @dataProvider startsWithDP
  */
 public function testStartsWith($a, $b, $c)
 {
     $obj = new _Strings();
     $this->boolean($obj->startsWith($a, $b))->isEqualTo($c);
 }
コード例 #2
0
ファイル: health_status.php プロジェクト: jotes/transvision
             break;
         case 'mobile':
             $path[] = $component . '/android/branding';
             $path[] = $component . '/android/defines.inc';
             $path[] = $component . '/chrome/region.properties';
             break;
         case 'suite':
             $path[] = $component . '/chrome/browser/region.properties';
             $path[] = $component . '/chrome/common/region.properties';
             break;
         case 'toolkit':
             $path[] = $component . '/content/tests/';
             break;
     }
     $english_entities = array_filter($english_entities, function ($entity) use($path) {
         return !Strings::startsWith($entity, $path);
     });
     // Map the values
     foreach ($english_entities as $entity) {
         $english_strings[$entity] = $strings[$ref_locale][$repo][$entity];
         if (isset($strings[$locale][$repo][$entity])) {
             $locale_strings[$entity] = $strings[$locale][$repo][$entity];
         }
     }
     // Get pretty name for component or fallback to folder name
     $name = in_array($component, array_keys(Project::$components_names)) ? Project::$components_names[$component] : $component;
     // Store stats and status data for current component and repo.
     $projects[$repo]['stats'] = $stats;
     $projects[$repo]['repos'][$component] = Health::getStatus($name, $english_strings, $locale_strings);
     unset($locale_entities, $english_entities, $english_strings, $locale_strings);
 }
コード例 #3
0
ファイル: Project.php プロジェクト: benoit-l/transvision
 /**
  * Return the correct locale code based on context
  * For example: given "es", returns "es-ES" for Bugzilla,
  * "es" for Gaia, "es-ES" for other repos.
  *
  * @param  string $locale  Name of the current locale
  * @param  string $context The context we need to use this locale in
  * @return string Locale code to use in the requested context
  */
 public static function getLocaleInContext($locale, $context)
 {
     $locale_mappings = [];
     // Bugzilla locales
     $locale_mappings['bugzilla'] = ['es' => 'es-ES', 'gu' => 'gu-IN', 'pa' => 'pa-IN', 'sr-Cyrl' => 'sr', 'sr-Latn' => 'sr'];
     // Gaia locales
     $locale_mappings['gaia'] = ['es-AR' => 'es', 'es-CL' => 'es', 'es-ES' => 'es', 'es-MX' => 'es', 'gu-IN' => 'gu', 'pa-IN' => 'pa', 'sr' => 'sr-Cyrl'];
     // Use Gaia mapping for all Gaia repositories
     if (Strings::startsWith($context, 'gaia')) {
         $context = 'gaia';
     }
     // Firefox for iOS
     $locale_mappings['firefox_ios'] = ['es-AR' => 'es', 'es-ES' => 'es'];
     // For other contexts use the same as Bugzilla
     $locale_mappings['other'] = $locale_mappings['bugzilla'];
     // Fallback to 'other' if context doesn't exist in $locale_mappings
     $context = array_key_exists($context, $locale_mappings) ? $context : 'other';
     $locale = array_key_exists($locale, $locale_mappings[$context]) ? $locale_mappings[$context][$locale] : $locale;
     return $locale;
 }