Skip to content

Commit

Permalink
Fixes #778: Remove Gaia (#779)
Browse files Browse the repository at this point in the history
* Remove Gaia

* Fix Travis + remove gaia from Health.php tests

* remove last references + update tests in AnalyseStrings.php
  • Loading branch information
TheoChevalier authored Jul 29, 2016
1 parent 72e77c9 commit e593ec3
Show file tree
Hide file tree
Showing 34 changed files with 82 additions and 929 deletions.
4 changes: 2 additions & 2 deletions app/classes/Transvision/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* Calls are like this:
* api/<version>/<service>/<repository>/<search type>/<source locale>/<target locale>/<url escaped search>/?optional_parameter1=foo&optional_parameter2=bar
* Example for an entity search containing bookmark:
* http://transvison.mozfr.org/api/v1/tm/release/entity/en-US/fr/bookmark/?case_sensitive=1
* https://transvision.mozfr.org/api/v1/tm/release/entity/en-US/fr/bookmark/?case_sensitive=1
* (tm = translation memory service)
*
* Example for the list of locales supported for a repo:
* http://transvison.mozfr.org/api/v1/locales/gaia/
* https://transvision.mozfr.org/api/v1/locales/mozilla_org/
*
* List of services:
* entity: Return translations for all locales of a Mozilla entity
Expand Down
5 changes: 0 additions & 5 deletions app/classes/Transvision/AnalyseStrings.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ public static function differences($tmx_source, $tmx_target, $repo, $ignored_str
$pattern_mismatch = [];

switch ($repo) {
case Strings::startsWith($repo, 'gaia'):
$patterns = [
'l10njs' => '/\{\{\s*([a-z0-9_]+)\s*\}\}/iu', // {{foobar2}}
];
break;
case 'firefox_ios':
$patterns = [
'ios' => '/(%(?:[0-9]+\$){0,1}@)/i', // %@, but also %1$@, %2$@, etc.
Expand Down
14 changes: 0 additions & 14 deletions app/classes/Transvision/Consistency.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public static function filterStrings($strings_array, $repo)
{
if (Project::isDesktopRepository($repo)) {
$repository_type = 'desktop';
} elseif (in_array($repo, Project::getGaiaRepositories())) {
$repository_type = 'gaia';
} else {
$repository_type = $repo;
}
Expand All @@ -77,18 +75,6 @@ public static function filterStrings($strings_array, $repo)
return true;
}

if ($repository_type == 'gaia') {
// Ignore plural forms containing [] in the key
if (Strings::inString($key, ['[', ']'])) {
return true;
}

// Ignore accessibility strings
if (strpos($key, 'accessibility.properties') !== false) {
return true;
}
}

if ($repository_type == 'desktop') {
/*
Ignore some specific files:
Expand Down
2 changes: 1 addition & 1 deletion app/classes/Transvision/Health.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public static function getStatsTab($data, $id, $active)

/**
* Create a panel containing tabs with info for all the repos of this group
* For instance, a panel with tabs for each gaia repo.
* For instance, a panel with tabs for mozilla_org and firefox_ios repos.
*
* @param array $data Array containing all the data for each repo
* @return string HTML element to add in the repo tab
Expand Down
86 changes: 3 additions & 83 deletions app/classes/Transvision/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,50 +25,6 @@ class Project
'calendar' => 'Lightning',
];

/**
* Read all supported Gaia versions.
*
* @return array list of supported Gaia versions
*/
public static function getSupportedGaiaVersions()
{
// Gaia versions are dynamically read from gaia_versions.txt
$file_name = APP_SOURCES . 'gaia_versions.txt';

$supported_versions = [];
if (file_exists($file_name)) {
$gaia_versions = file($file_name, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($gaia_versions as $gaia_version) {
if ($gaia_version == 'gaia') {
$supported_versions += [
'gaia' => 'Gaia master',
];
} else {
$repo_name = "gaia_{$gaia_version}";
$repo_description = 'Gaia ' . str_replace('_', '.', $gaia_version);
$supported_versions += [
$repo_name => $repo_description,
];
}
}
}

return $supported_versions;
}

/**
* Return the most updated Gaia branch besides master
*
* @return string name of the most updated Gaia branch
*/
public static function getLastGaiaBranch()
{
$gaia_repos = array_keys(self::getSupportedGaiaVersions());
rsort($gaia_repos);

return reset($gaia_repos);
}

/**
* Create a list of all supported repositories.
*
Expand Down Expand Up @@ -106,7 +62,7 @@ public static function getRepositories()
/**
* Get the list of repositories with their Display name.
* The array has repo folder names as keys and Display names as value:
* ex: ['gaia_1_4' => 'Gaia 1.4', 'mozilla_org' => 'mozilla.org']
* ex: ['firefox_ios' => 'Firefox for iOS', 'mozilla_org' => 'mozilla.org']
*
* @return array list of local repositories and their Display names
*/
Expand All @@ -115,24 +71,6 @@ public static function getRepositoriesNames()
return self::getSupportedRepositories();
}

/**
* Get the list of repositories for Gaia.
* The list is sorted by age (latest master -> older branch)
*
* @return array list of local repositories for Gaia
*/
public static function getGaiaRepositories()
{
$gaia_repos = array_keys(self::getSupportedGaiaVersions());
rsort($gaia_repos);

// 'gaia' repo is the latest master branch, always first
array_pop($gaia_repos);
array_unshift($gaia_repos, 'gaia');

return $gaia_repos;
}

/**
* Get the list of repositories for desktop applications
*
Expand All @@ -142,8 +80,7 @@ public static function getDesktopRepositories()
{
return array_diff(
self::getRepositories(),
['mozilla_org', 'firefox_ios'],
self::getGaiaRepositories()
['mozilla_org', 'firefox_ios']
);
}

Expand Down Expand Up @@ -228,8 +165,7 @@ public static function isValidRepository($repository)

/**
* 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.
* For example: given "es", returns "es-ES" for Bugzilla.
*
* @param string $locale Name of the current locale
* @param string $context The context we need to use this locale in
Expand All @@ -248,22 +184,6 @@ public static function getLocaleInContext($locale, $context)
'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',
Expand Down
4 changes: 2 additions & 2 deletions app/classes/Transvision/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public static function getHtmlSelectOptions($options, $selected, $nice_labels =
/**
* Return an array of strings for a locale from a repository
* @param string $locale Locale we want to have strings for
* @param string $repository string repository such as gaia_2_5, central...
* @param string $repository string repository such as central, mozilla_org...
* @return array Localized strings or empty array if no match
*/
public static function getRepoStrings($locale, $repository)
Expand All @@ -263,7 +263,7 @@ public static function getRepoStrings($locale, $repository)
/**
* Return an array of entities for a locale from a repository
* @param string $locale Locale we want to have entities for
* @param string $repository string repository such as gaia_2_5, central...
* @param string $repository string repository such as central, mozilla_org...
* @return array Entities or empty array if no match
*/
public static function getRepoEntities($locale, $repository)
Expand Down
27 changes: 0 additions & 27 deletions app/classes/Transvision/VersionControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public static function getVCS($repo)
];
$vcs['hg'] = array_merge(
Project::getDesktopRepositories(),
Project::getGaiaRepositories(),
$vcs['hg']
);
foreach ($vcs as $system => $repos) {
Expand All @@ -50,11 +49,6 @@ public static function VCSRepoName($repo)
$repo = strtoupper($repo == 'central' ? 'trunk' : $repo) . '_L10N';
}

// Gaia
if (substr($repo, 0, 4) == 'gaia') {
$repo = strtoupper($repo);
}

return $repo;
}

Expand All @@ -79,27 +73,6 @@ public static function hgPath($locale, $repo, $path)
$exploded_path = explode('/', $path);
$base_folder = $exploded_path[0];

if (Strings::startsWith($repo, 'gaia')
|| in_array(
$base_folder,
[
'apps', 'shared', 'showcase_apps',
'test_apps', 'test_external_apps',
]
)
) {
$locale = Project::getLocaleInContext($locale, $repo);

if ($repo == 'gaia') {
$url .= '/gaia-l10n/' . $locale . '/file/default/';
} else {
$version = str_replace('gaia_', '', $repo);
$url .= '/releases/gaia-l10n/v' . $version . '/' . $locale . '/file/default/';
}

return $url . $path . '/' . $entity_file;
}

$en_US_folder_mess = [
'b2g/',
'b2g/branding/official/',
Expand Down
3 changes: 1 addition & 2 deletions app/config/config.ini-travis
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ install=/home/travis/build/mozfr/transvision/
config=/home/travis/build/mozfr/transvision/app/config

; URL to l10n web service. Wrap the value between quotes if the URL contains special characters like ~
l10nwebservice = "https://l10n.mozilla-community.org/~flod/mozilla-l10n-query/"
l10nwebservice = "https://flod.org/mozilla-l10n-query/"

; Path to the local Mercurial clones, both en-US and l10n. Could be external
; to the Git checkout of Transvision, as long as scripts have access to it.
Expand All @@ -29,6 +29,5 @@ local_svn=/home/travis/build/mozfr/transvision/data/svn
; This path is used to store libraries (e.g. silme)
libraries=/home/travis/build/mozfr/transvision/data/libraries


; Flag to know if we are working in production more or development mode
dev=true
5 changes: 0 additions & 5 deletions app/inc/dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@
$css_files[] = 'tmx.css';
$js_files[] = '/js/select_all.js';
break;
case 'gaia':
$view = 'gaia';
$page_title = 'Gaia Comparison';
$page_descr = 'Check the Status of your GAIA strings across repositories.';
break;
case 'news':
$controller = 'changelog';
$page_title = 'Transvision News and Release Notes';
Expand Down
1 change: 0 additions & 1 deletion app/inc/urls.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
'credits' => 'credits',
'downloads' => 'downloads',
'showrepos' => 'showrepos',
'gaia' => 'gaia',
'unchanged' => 'unchangedstrings',
'unlocalized' => 'unlocalized',
'unlocalized-all' => 'unlocalized_all',
Expand Down
1 change: 0 additions & 1 deletion app/inc/variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
// Repositories
$repos = Project::getRepositories();
$repos_nice_names = Project::getRepositoriesNames();
$gaia_repos = Project::getGaiaRepositories();
$desktop_repos = Project::getDesktopRepositories();
14 changes: 7 additions & 7 deletions app/models/changelog_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@
'authors' => ['flod'],
],
[
'message' => ['<a href="https://transvision.mozfr.org/gaia/">Gaia view</a> now has URL anchors for subsections and less false positives in translation consistency table'],
'message' => ['Gaia view now has URL anchors for subsections and less false positives in translation consistency table'],
'section' => ['end_user'],
'type' => ['better'],
'authors' => ['flod'],
Expand Down Expand Up @@ -1241,7 +1241,7 @@
'authors' => ['tchevalier'],
],
[
'message' => ['<strong>Translation Consistency in Gaia view:</strong> The <a href="https://transvision.mozfr.org/gaia/">gaia view</a> has an additional table listing all the inconsistencies in translations in your repository, those are of course not necessarily bugs as an English term can be translated differently depending on context'],
'message' => ['<strong>Translation Consistency in Gaia view:</strong> The gaia view has an additional table listing all the inconsistencies in translations in your repository, those are of course not necessarily bugs as an English term can be translated differently depending on context'],
'section' => ['end_user'],
'type' => ['new'],
'authors' => ['flod'],
Expand Down Expand Up @@ -1302,7 +1302,7 @@
'authors' => ['pascal'],
],
[
'message' => ['<strong>Dynamic Gaia comparison view:</strong> allows <a href="https://transvision.mozfr.org/gaia/?locale=fr&amp;repo1=gaia_1_3&amp;repo2=gaia_1_4">comparison of combinations of repositories/locales</a>'],
'message' => ['<strong>Dynamic Gaia comparison view:</strong> allows comparison of combinations of repositories/locales'],
'section' => ['end_user'],
'type' => ['new'],
'authors' => ['tchevalier'],
Expand Down Expand Up @@ -1419,7 +1419,7 @@
'authors' => ['flod'],
],
[
'message' => ['Switched Gaia comparison view to 1.3 in <a href="https://transvision.mozfr.org/gaia/">QA view</a>'],
'message' => ['Switched Gaia comparison view to 1.3 in QA view'],
'section' => ['end_user'],
'authors' => ['pike'],
],
Expand Down Expand Up @@ -1469,7 +1469,7 @@
'authors' => ['pascal'],
],
[
'message' => ['On the <a href="https://transvision.mozfr.org/gaia/#englishchanges">Gaia comparison</a> view list the strings that have changed significantly in English between Gaia 1.1 and 1.2 releases without an entity change'],
'message' => ['On the Gaia comparison view list the strings that have changed significantly in English between Gaia 1.1 and 1.2 releases without an entity change'],
'section' => ['end_user'],
'authors' => ['pascal'],
],
Expand Down Expand Up @@ -1509,7 +1509,7 @@
'authors' => ['pascal'],
],
[
'message' => ['The new view showing all strings for a translation also <a href="https://transvision.mozfr.org/string/?entity=apps/homescreen/homescreen.properties:evme-searchbar-default.placeholder&amp;repo=gaia&amp;json">exists as a Json/JsonP source</a> which means that a string can be imported for all locales into another project via this web service'],
'message' => ['The new view showing all strings for a translation also <a href="https://transvision.mozfr.org/api/v1/entity/aurora/?id=browser/chrome/browser/aboutDialog.dtd:aboutDialog.title&amp;json">exists as a Json/JsonP source</a> which means that a string can be imported for all locales into another project via this web service'],
'section' => ['developers'],
'authors' => ['pascal'],
],
Expand All @@ -1531,7 +1531,7 @@
'authors' => ['pascal'],
],
[
'message' => ['New (experimental) <a href="https://transvision.mozfr.org/gaia/">QA view for strings in Gaia repos</a> listing the differences in translations for the same entities across gaia-l10n, gaia_1.1 and gaia_1.2 repos as well as listing all the strings added to Gaia 1.2 as they require more attention'],
'message' => ['New (experimental) QA view for strings in Gaia repos listing the differences in translations for the same entities across gaia-l10n, gaia_1.1 and gaia_1.2 repos as well as listing all the strings added to Gaia 1.2 as they require more attention'],
'section' => ['end_user'],
'type' => ['experimental'],
'authors' => ['pascal'],
Expand Down
Loading

0 comments on commit e593ec3

Please sign in to comment.