From 0d41f5c4d7a8f5f3f9787d31cd6adc1ea424396c Mon Sep 17 00:00:00 2001 From: fwenzel@mozilla.com Date: Wed, 10 Jun 2009 17:33:21 +0000 Subject: collections l10n fallback (bug 497276, r=clouserw) git-svn-id: http://svn.mozilla.org/addons/trunk@27481 4eb1ac78-321c-0410-a911-ec516a8615a5 --- 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); -- cgit v0.9.1