Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfwenzel@mozilla.com <fwenzel@mozilla.com@4eb1ac78-321c-0410-a911-ec516a8615a5>2009-06-10 17:33:21 (GMT)
committer fwenzel@mozilla.com <fwenzel@mozilla.com@4eb1ac78-321c-0410-a911-ec516a8615a5>2009-06-10 17:33:21 (GMT)
commit0d41f5c4d7a8f5f3f9787d31cd6adc1ea424396c (patch)
treed373e9e2912e26fbdeaa0289490436339c362543
parente3b282413aa99904d8b611da06907dc74e508600 (diff)
collections l10n fallback (bug 497276, r=clouserw)
git-svn-id: http://svn.mozilla.org/addons/trunk@27481 4eb1ac78-321c-0410-a911-ec516a8615a5
-rw-r--r--site/app/app_model.php14
-rw-r--r--site/app/config/sql/remora.sql1
-rw-r--r--site/app/controllers/collections_controller.php1
3 files changed, 12 insertions, 4 deletions
diff --git a/site/app/app_model.php b/site/app/app_model.php
index 2b484f2..819c6f7 100644
--- a/site/app/app_model.php
+++ b/site/app/app_model.php
@@ -81,12 +81,18 @@ class AppModel extends Model
// Allow querying for a locale other than currently set
$lang = $this->getLang();
- // fallback language is usually English. If we are selecting addons however,
- // we fall back to what's defined for that addon.
- if ($this->name == 'Addon') {
+ // fallback language is usually English. Some models have special
+ // fallback options, however, so we are handling them here.
+ switch ($this->name) {
+ case 'Addon':
$fb_locale = '`Addon`.`defaultlocale`';
- } else {
+ break;
+ case 'Collection':
+ $fb_locale = '`Collection`.`defaultlocale`';
+ break;
+ default:
$fb_locale = "'en-US'";
+ break;
}
// These parts are separated due to the way the query is built
diff --git a/site/app/config/sql/remora.sql b/site/app/config/sql/remora.sql
index 71b7c65..f3eaac1 100644
--- a/site/app/config/sql/remora.sql
+++ b/site/app/config/sql/remora.sql
@@ -1024,6 +1024,7 @@ CREATE TABLE `collections` (
`id` int(11) unsigned NOT NULL auto_increment,
`uuid` char(36) NOT NULL default '',
`name` int(11) unsigned NOT NULL,
+ `defaultlocale` varchar(10) NOT NULL default 'en-US',
`collection_type` int(11) unsigned NOT NULL DEFAULT '0',
`icondata` blob,
`icontype` varchar(25) NOT NULL default '',
diff --git a/site/app/controllers/collections_controller.php b/site/app/controllers/collections_controller.php
index a733130..3c77e2f 100644
--- a/site/app/controllers/collections_controller.php
+++ b/site/app/controllers/collections_controller.php
@@ -203,6 +203,7 @@ class CollectionsController extends AppController
$user = $this->Session->read('User');
$this->data['Collection']['user_id'] = $user['id'];
$this->data['Collection']['application_id'] = APP_ID; // defaults to current app
+ $this->data['Collection']['defaultlocale'] = LANG; // defaults to current lang
$data = $this->data['Collection'];
$this->Amo->clean($data);