Index: trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N.pm
===================================================================
--- trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N.pm (revision 43)
+++ trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N.pm (revision 817)
@@ -1,7 +1,7 @@
-# Copyright 2001-2006 Six Apart. This code cannot be redistributed without
-# permission from www.sixapart.com.  For more information, consult your
-# Movable Type license.
+# Movable Type (r) Open Source (C) 2005-2008 Six Apart, Ltd.
+# This program is distributed under the terms of the
+# GNU General Public License, version 2.
 #
-# $Id: L10N.pm 29367 2006-05-20 04:42:10Z bchoate $
+# $Id: L10N.pm 1174 2008-01-08 21:02:50Z bchoate $
 
 package StyleCatcher::L10N;
Index: trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N/es.pm
===================================================================
--- trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N/es.pm (revision 817)
+++ trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N/es.pm (revision 817)
@@ -0,0 +1,60 @@
+# Movable Type (r) Open Source (C) 2005-2008 Six Apart, Ltd.
+# This program is distributed under the terms of the
+# GNU General Public License, version 2.
+#
+# $Id$
+
+package StyleCatcher::L10N::es;
+
+use strict;
+use base 'StyleCatcher::L10N::en_us';
+use vars qw( %Lexicon );
+
+## The following is the translation table.
+
+%Lexicon = (
+## plugins/StyleCatcher/lib/StyleCatcher/CMS.pm
+	'Your mt-static directory could not be found. Please configure \'StaticFilePath\' to continue.' => 'No se encontrÃ³ el directorio mt-static. Por favor, configure el \'StaticFilePath\' para continuar.',
+	'Could not create [_1] folder - Check that your \'themes\' folder is webserver-writable.' => 'No se pudo crear el directorio [_1] - Compruebe que el servidor web puede escribir en la carpeta \'themes\'.',
+	'Error downloading image: [_1]' => 'Error descargando imagen: [_1]',
+	'Successfully applied new theme selection.' => 'Se aplicÃ³ con Ã©xito la nueva selecciÃ³n de estilo.',
+	'Invalid URL: [_1]' => 'URL no vÃ¡lida: [_1]',
+
+## plugins/StyleCatcher/tmpl/view.tmpl
+	'Select a Style' => 'Seleccione un estilo',
+	'3-Columns, Wide, Thin, Thin' => '3 columnas, ancha, delgada, delgada',
+	'3-Columns, Thin, Wide, Thin' => '3 columnas, delgada, ancha, delgada',
+	'2-Columns, Thin, Wide' => '2 columnas, delgada, ancha',
+	'2-Columns, Wide, Thin' => '2 columnas, ancha, delgada',
+	'2-Columns, Wide, Medium' => '2 columnas, ancha, media', # Translate - New
+	'None available' => 'Ninguno disponible',
+	'Applying...' => 'Aplicando...',
+	'Apply Design' => 'Aplicar diseÃ±o',
+	'Error applying theme: ' => 'Error aplicando tema:',
+	'The selected theme has been applied, but as you have changed the layout, you will need to republish your blog to apply the new layout.' => 'Se ha aplicado el tema seleccionado, pero como la disposiciÃ³n ha cambiado, deberÃ¡ republicar el blog para que se aplique la disposiciÃ³n.',
+	'The selected theme has been applied!' => 'Â¡Se ha aplicado el tema seleccionado!',
+	'Error loading themes! -- [_1]' => 'Â¡Error cargando temas! -- [_1]',
+	'Stylesheet or Repository URL' => 'URL de la hoja de estilo o repositorio:',
+	'Stylesheet or Repository URL:' => 'URL de la hoja de estilo o repositorio:',
+	'Download Styles' => 'Descargar estilos',
+	'Current theme for your weblog' => 'Estilo actual de su weblog',
+	'Current Style' => 'Estilo actual',
+	'Locally saved themes' => 'Estilos guardados localmente',
+	'Saved Styles' => 'Estilos guardados',
+	'Default Styles' => 'Estilos predefinidos',
+	'Single themes from the web' => 'Estilos individuales del web',
+	'More Styles' => 'MÃ¡s estilos',
+	'Selected Design' => 'DiseÃ±o seleccionado',
+	'Layout' => 'DisposiciÃ³n',
+
+## plugins/StyleCatcher/stylecatcher.pl
+	'StyleCatcher lets you easily browse through styles and then apply them to your blog in just a few clicks. To find out more about Movable Type styles, or for new sources for styles, visit the <a href=\'http://www.sixapart.com/movabletype/styles\'>Movable Type styles</a> page.' => 'StyleCatcher le permite navegar fÃ¡cilmente por los estilos y aplicarlos a su blog fÃ¡cilmente. Para mÃ¡s informaciÃ³n sobre los estilos de Movable Type, o para encontrar mÃ¡s repositorios de estilos, visite la pÃ¡gina de <a href=\'http://www.sixapart.com/movabletype/styles\'>estilos de Movable Type</a>.',
+	'MT 4 Style Library' => 'LibrerÃ­a de estilos de MT 4',
+	'A collection of styles compatible with Movable Type 4 default templates.' => 'Una colecciÃ³n de estilos compatible con las plantillas predefinidas de Movable Type.',
+	'MT 3 Style Library' => 'LibrerÃ­a de estilos de MT 3',
+	'A collection of styles compatible with Movable Type 3.3+ default templates.' => 'Una colecciÃ³n de estilos compatible con las plantillas predefinidas de Movable 3.3+.',
+	'Styles' => 'Estilos',
+);
+
+1;
+
Index: trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N/fr.pm
===================================================================
--- trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N/fr.pm (revision 817)
+++ trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N/fr.pm (revision 817)
@@ -0,0 +1,60 @@
+# Movable Type (r) Open Source (C) 2005-2008 Six Apart, Ltd.
+# This program is distributed under the terms of the
+# GNU General Public License, version 2.
+#
+# $Id$
+
+package StyleCatcher::L10N::fr;
+
+use strict;
+use base 'StyleCatcher::L10N::en_us';
+use vars qw( %Lexicon );
+
+## The following is the translation table.
+
+%Lexicon = (
+## plugins/StyleCatcher/lib/StyleCatcher/CMS.pm
+	'Your mt-static directory could not be found. Please configure \'StaticFilePath\' to continue.' => 'Le rÃ©pertoire mt-static n\'a pas pu Ãªtre trouvÃ©. Veuillez configurer le \'StaticFilePath\' pour continuer.',
+	'Could not create [_1] folder - Check that your \'themes\' folder is webserver-writable.' => 'Impossible de crÃ©er le dossier [_1] - VÃ©rifiez que votre dossier \'themes\' et en mode webserveur/Ã©criture.',
+	'Error downloading image: [_1]' => 'Erreur en tÃ©lÃ©chargeant l\'image : [_1]',
+	'Successfully applied new theme selection.' => 'SÃ©lection de nouveau ThÃšme appliquÃ©e avec succÃšs.',
+	'Invalid URL: [_1]' => 'URL inaccessible : [_1]',
+
+## plugins/StyleCatcher/tmpl/view.tmpl
+	'Select a Style' => 'Habillages',
+	'3-Columns, Wide, Thin, Thin' => '3-colonnes, large, fin, fin',
+	'3-Columns, Thin, Wide, Thin' => '3-colonnes, fin, large, fin',
+	'2-Columns, Thin, Wide' => '2-colonnes, fin, large',
+	'2-Columns, Wide, Thin' => '2-colonnes, large, fin',
+	'None available' => 'Aucun disponible',
+	'Applying...' => 'Appliquer...',
+	'Apply Design' => 'Appliquer l\'habillage',
+	'Error applying theme: ' => 'Erreur en appliquant l\'habillage:',
+	'The selected theme has been applied, but as you have changed the layout, you will need to republish your blog to apply the new layout.' => 'L\'habillage sÃ©lectionnÃ© a Ã©tÃ© appliquÃ©. Vous devez republier votre blog afin d\'appliquer la nouvelle mise en page.',
+	'The selected theme has been applied!' => 'L\'habillage sÃ©lectionnÃ© a Ã©tÃ© appliquÃ©!',
+	'Error loading themes! -- [_1]' => 'Erreur lors du chargement des habillages ! -- [_1]',
+	'Stylesheet or Repository URL' => 'URL de la feuille de style ou du rÃ©pertoire',
+	'Stylesheet or Repository URL:' => 'URL de la feuille de style ou du rÃ©pertoire:',
+	'Download Styles' => 'TÃ©lÃ©charger des habillages',
+	'Current theme for your weblog' => 'ThÃšme actuel de votre weblog',
+	'Current Style' => 'Habillage actuel',
+	'Locally saved themes' => 'ThÃšmes enregistrÃ©s localement',
+	'Saved Styles' => 'Habillages enregistrÃ©s',
+	'Default Styles' => 'Habillages par dÃ©faut',
+	'Single themes from the web' => 'ThÃšmes uniques venant du web',
+	'More Styles' => 'Plus d\'habillages',
+	'Selected Design' => 'Habillage sÃ©lectionnÃ©',
+	'Layout' => 'Mise en page',
+
+## plugins/StyleCatcher/stylecatcher.pl
+	'StyleCatcher lets you easily browse through styles and then apply them to your blog in just a few clicks. To find out more about Movable Type styles, or for new sources for styles, visit the <a href=\'http://www.sixapart.com/movabletype/styles\'>Movable Type styles</a> page.' => 'StyleCatcher vous permet de naviguer facilement Ã  travers des styles et de les appliquer Ã  votre blog en quelques clics seulement. Pour en savoir plus Ã  propos des styles Movable Type, ou pour avoir de nouvelles sources de styles, visitez la page <a href=\'http://www.sixapart.com/movabletype/styles\'>Movable Type styles</a>.',
+	'MT 4 Style Library' => 'BibliothÃšque MT4',
+	'A collection of styles compatible with Movable Type 4 default templates.' => 'Une gamme de styles compatibles avec les gabarits MT4 par dÃ©faut',
+	'MT 3 Style Library' => 'BibliothÃšque MT3',
+	'A collection of styles compatible with Movable Type 3.3+ default templates.' => 'Une gamme de styles compatibles avec les gabarits MT3.3+ par dÃ©faut',
+	'Styles' => 'Habillages',
+	'2-Columns, Wide, Medium' => '2-Colonnes, Large, Moyen', # Translate - New
+	);
+
+1;
+
Index: trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N/de.pm
===================================================================
--- trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N/de.pm (revision 817)
+++ trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N/de.pm (revision 817)
@@ -0,0 +1,60 @@
+# Movable Type (r) Open Source (C) 2005-2008 Six Apart, Ltd.
+# This program is distributed under the terms of the
+# GNU General Public License, version 2.
+#
+# $Id$
+
+package StyleCatcher::L10N::de;
+
+use strict;
+use base 'StyleCatcher::L10N::en_us';
+use vars qw( %Lexicon );
+
+## The following is the translation table.
+
+%Lexicon = (
+## plugins/StyleCatcher/lib/StyleCatcher/CMS.pm
+	'Your mt-static directory could not be found. Please configure \'StaticFilePath\' to continue.' => 'Ihr mt-static-Ordner konnte nicht gefunden werden. Bitte konfigurieren Sie \'StaticFilePath\' um fortzufahren.',
+	'Could not create [_1] folder - Check that your \'themes\' folder is webserver-writable.' => 'Konnte den Ordner [_1] nicht anlegen. Stellen Sie sicher, daÃ der Webserver Schreibrechte auf dem \'themes\'-Ordner hat.',
+	'Error downloading image: [_1]' => 'Fehler beim Herunterladen einer Bilddatei: [_1]',
+	'Successfully applied new theme selection.' => 'Neue Themenauswahl erfolgreich angewendet.',
+	'Invalid URL: [_1]' => 'UngÃŒltige URL: [_1]',
+
+## plugins/StyleCatcher/tmpl/view.tmpl
+	'Select a Style' => 'Design wÃ€hlen',
+	'3-Columns, Wide, Thin, Thin' => 'Dreispaltig: breit - schmal - schmal',
+	'3-Columns, Thin, Wide, Thin' => 'Dreispaltig: schmal - breit - schmal',
+	'2-Columns, Thin, Wide' => 'Zweispaltig: schmal - breit',
+	'2-Columns, Wide, Thin' => 'Zweispaltig: breit - schmal',
+	'None available' => 'Keine verfÃŒgbar',
+	'Applying...' => 'Wende an...',
+	'Apply Design' => 'Design ÃŒbernehmen',
+	'Error applying theme: ' => 'Fehler bei der Ãbernahme des Themas:',
+	'The selected theme has been applied, but as you have changed the layout, you will need to republish your blog to apply the new layout.' => 'Das gewÃ€hlte Thema wurde ÃŒbernommen. Da das Layout geÃ€ndert wurde, verÃ¶ffentlichen Sie das Blog bitte erneut, um die Ãnderungen wirksam werden zu lassen.',
+	'The selected theme has been applied!' => 'Das Thema wurde ÃŒbernommen!',
+	'Error loading themes! -- [_1]' => 'Fehler beim Laden der Themen -- [_1]',
+	'Stylesheet or Repository URL' => 'URL des Stylesheets oder der Sammlung',
+	'Stylesheet or Repository URL:' => 'URL des Stylesheets oder der Sammlung:',
+	'Download Styles' => 'Designs herunterladen',
+	'Current theme for your weblog' => 'Aktuelles Theme Ihres Weblogs',
+	'Current Style' => 'Derzeitige Design',
+	'Locally saved themes' => 'Lokal gespeicherte Themes',
+	'Saved Styles' => 'Gespeicherte Designs',
+	'Default Styles' => 'Standarddesigns',
+	'Single themes from the web' => 'Einzelne Themes aus dem Web',
+	'More Styles' => 'Weitere Designs',
+	'Selected Design' => 'GewÃ€hltes Design',
+	'Layout' => 'Layout',
+
+## plugins/StyleCatcher/stylecatcher.pl
+	'StyleCatcher lets you easily browse through styles and then apply them to your blog in just a few clicks. To find out more about Movable Type styles, or for new sources for styles, visit the <a href=\'http://www.sixapart.com/movabletype/styles\'>Movable Type styles</a> page.' => 'Mit StyleCatchter kÃ¶nnen Sie spielend leicht neue Designvorlagen fÃŒr Ihre Blogs finden und mit wenigen Klicks direkt aus dem Internet installieren. Mehr dazu auf der <a href=\'http://www.sixapart.com/movabletype/styles\'>Movable Type Styles</a>-Seite.',
+	'MT 4 Style Library' => 'MT 4-Designs',
+	'A collection of styles compatible with Movable Type 4 default templates.' => 'Mit den Standardvorlagen von MT 3.3+  kompatible Designvorlagen',
+	'MT 3 Style Library' => 'MT 3-Design',
+	'A collection of styles compatible with Movable Type 3.3+ default templates.' => 'Mit den Standardvorlagen von MT 3.3+  kompatible Designvorlagen',
+	'Styles' => 'Designs',
+	'2-Columns, Wide, Medium' => 'Zweispaltig: breit - mittel', # Translate - New # OK
+	);
+
+1;
+
Index: trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N/en_us.pm
===================================================================
--- trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N/en_us.pm (revision 28)
+++ trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N/en_us.pm (revision 817)
@@ -1,2 +1,8 @@
+# Movable Type (r) Open Source (C) 2005-2008 Six Apart, Ltd.
+# This program is distributed under the terms of the
+# GNU General Public License, version 2.
+#
+# $Id: en_us.pm 1174 2008-01-08 21:02:50Z bchoate $
+
 package StyleCatcher::L10N::en_us;
 
Index: trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N/nl.pm
===================================================================
--- trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N/nl.pm (revision 817)
+++ trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N/nl.pm (revision 817)
@@ -0,0 +1,61 @@
+# Movable Type (r) Open Source (C) 2005-2008 Six Apart, Ltd.
+# This program is distributed under the terms of the
+# GNU General Public License, version 2.
+#
+# $Id$
+
+package StyleCatcher::L10N::nl;
+
+use strict;
+use base 'StyleCatcher::L10N::en_us';
+use vars qw( %Lexicon );
+
+## The following is the translation table.
+
+%Lexicon = (
+## plugins/StyleCatcher/lib/StyleCatcher/CMS.pm
+	'Your mt-static directory could not be found. Please configure \'StaticFilePath\' to continue.' => 'Uw mt-static map kon niet worden gevonden.  Gelieve \'StaticFilePath\' te configureren om verder te gaan.',
+	'Could not create [_1] folder - Check that your \'themes\' folder is webserver-writable.' => 'Kon map [_1] niet aanmaken - Controleer of uw \'themes\' map beschrijfbaar is voor de webserver.',
+	'Error downloading image: [_1]' => 'Fout bij downloaden afbeelding: [_1]',
+	'Successfully applied new theme selection.' => 'Nieuwe thema-selectie met succes toegepast.',
+	'Invalid URL: [_1]' => 'Ongeldige URL: [_1]',
+
+## plugins/StyleCatcher/tmpl/view.tmpl
+	'Select a Style' => 'Selecteer een stijl',
+	'3-Columns, Wide, Thin, Thin' => '3-kolommen, breed, smal, smal',
+	'3-Columns, Thin, Wide, Thin' => '3-kolommen, smal, breed, smal',
+	'2-Columns, Thin, Wide' => '2-kolommen, smal, breed',
+	'2-Columns, Wide, Thin' => '2-kolommen, breed, smal',
+	'2-Columns, Wide, Medium' => '2-kolommen, breed, medium', # Translate - New
+	'None available' => 'Geen beschikbaar',
+	'Applying...' => 'Wordt toegepast...',
+	'Apply Design' => 'Design toepassen',
+	'Error applying theme: ' => 'Fout bij toepassen thema:',
+	'The selected theme has been applied, but as you have changed the layout, you will need to republish your blog to apply the new layout.' => 'Het geselecteerde thema is toegepast, maar omdat u een andere lay-out heeft gekozen, moet u eerst uw weblog opnieuw publiceren om de nieuwe lay-out zichtbaar te maken.',
+	'The selected theme has been applied!' => 'Het geselecteerde thema is toegepast',
+	'Error loading themes! -- [_1]' => 'Fout bij het laden van thema\'s! -- [_1]',
+	'Stylesheet or Repository URL' => 'Stylesheet of bibliotheek URL',
+	'Stylesheet or Repository URL:' => 'Stylesheet of bibliotheek URL:',
+	'Download Styles' => 'Stijlen downloaden',
+	'Current theme for your weblog' => 'Huidig thema van uw weblog',
+	'Current Style' => 'Huidige stijl',
+	'Locally saved themes' => 'Lokaal opgeslagen thema\'s',
+	'Saved Styles' => 'Opgeslagen stijlen',
+	'Default Styles' => 'Standaard stijlen',
+	'Single themes from the web' => 'Losse thema\'s van het web',
+	'More Styles' => 'Meer stijlen',
+	'Selected Design' => 'Geselecteerde designs',
+	'Layout' => 'Lay-out',
+
+## plugins/StyleCatcher/stylecatcher.pl
+	'StyleCatcher lets you easily browse through styles and then apply them to your blog in just a few clicks. To find out more about Movable Type styles, or for new sources for styles, visit the <a href=\'http://www.sixapart.com/movabletype/styles\'>Movable Type styles</a> page.' => 'Met StyleCatcher kunt u makkelijk een keuze maken tussen stijlen om ze daarna op uw blog toe te passen in een paar klikken.  Om meer te weten over Movable Type stijlen, of om een bron te vinden van nog meer stijlen, bezoek de <a href=\'http://www.sixapart.com/movabletype/styles\'>Movable Type styles</a> pagina.',
+	'MT 4 Style Library' => 'MT 4 Stijlenbibliotheek',
+	'A collection of styles compatible with Movable Type 4 default templates.' => 'Een verzameling stijlen compatibel met de standaardsjablonen van Movable Type 4.',
+	'MT 3 Style Library' => 'MT 3 Stijlenbibliotheek',
+	'A collection of styles compatible with Movable Type 3.3+ default templates.' => 'Een verzameling stijlen compatibel met de standaardsjablonen van Movable Type 3.3+.',
+	'Styles' => 'Stijlen',
+
+);
+
+1;
+
Index: trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N/ja.pm
===================================================================
--- trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N/ja.pm (revision 68)
+++ trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/L10N/ja.pm (revision 817)
@@ -1,2 +1,8 @@
+# Movable Type (r) Open Source (C) 2005-2008 Six Apart, Ltd.
+# This program is distributed under the terms of the
+# GNU General Public License, version 2.
+#
+# $Id: ja.pm 2003 2008-04-21 10:34:46Z fumiakiy $
+
 package StyleCatcher::L10N::ja;
 
@@ -8,59 +14,50 @@
 
 %Lexicon = (
-    'Applying...' => 'é©çšäž­...',
-    'Apply Selected Design' => 'ãã¶ã€ã³ãé©çš',
-    'Before using StyleCatcher, you must specify the Theme Root URL and Path for the installation in the system-level plugin settings for StyleCatcher.' => 'StyleCatcherãå©çšããã«ã¯ãã·ã¹ãã ã¡ãã¥ãŒã®StyleCatcherãã©ã°ã€ã³ã®èš­å®ã§ãã«ãŒãURLãšã«ãŒããã¹ãæå®ããå¿
+
+## plugins/StyleCatcher/tmpl/view.tmpl
+	'Select a Style' => 'ã¹ã¿ã€ã«ãéžæ',
+	'3-Columns, Wide, Thin, Thin' => '3ã«ã©ã ãå€§ã»å°ã»å°',
+	'3-Columns, Thin, Wide, Thin' => '3ã«ã©ã ãå°ã»å€§ã»å°',
+	'2-Columns, Thin, Wide' => '2ã«ã©ã ãå°ã»å€§',
+	'2-Columns, Wide, Thin' => '2ã«ã©ã ãå€§ã»å°',
+	'2-Columns, Wide, Medium' => '2ã«ã©ã ãå€§ã»äž­',
+	'2-Columns, Medium, Wide' => '2ã«ã©ã ãäž­ã»å€§', # Translate - New
+	'None available' => 'èŠã€ãããŸãã',
+	'Applying...' => 'é©çšäž­...',
+	'Apply Design' => 'ãã¶ã€ã³ãé©çš',
+	'Error applying theme: ' => 'ããŒããé©çšäž­ã«ãšã©ãŒãçºçããŸããã',
+	'The selected theme has been applied, but as you have changed the layout, you will need to republish your blog to apply the new layout.' => 'ããŒããé©çšããŸãããã¬ã€ã¢ãŠããå€æŽãããã®ã§ãåæ§ç¯ããå¿
 èŠããããŸãã',
-    'Choose this Design' => 'ãã®ãã¶ã€ã³ãéžæ',
-    'click here.' => 'ãããã¯ãªãã¯ããŠãã ããã',
-    'Configure plugin' => 'ãã©ã°ã€ã³ã®æ§æ',
-    "Could not create [_1] folder - Check that your 'themes' folder is webserver-writable." => '[_1] ãã£ã¬ã¯ããªãäœæã§ããŸããã§ãããWebãµãŒããŒããããŒãã®ãã£ã¬ã¯ããªã«æžãèŸŒã¿ãã§ãããã©ããç¢ºèªããŠãã ããã',
-    'Current Theme' => 'çŸåšã®ããŒã',
-    'Current theme for your weblog' => 'ãã­ã°ã®çŸåšã®ããŒã',
-    'Current Themes' => 'çŸåšã®ããŒã',
-    'Current themes for your weblogs' => 'ãã­ã°ã®çŸåšã®ããŒã',
-    'Error loading themes! -- [_1]' => 'ããŒããã­ãŒãã§ããŸããã§ãã: [_1]',
-    'Find Style' => 'ã¹ã¿ã€ã«æ€çŽ¢',
-    'Find Styles' => 'ã¹ã¿ã€ã«æ€çŽ¢',
-    'Hide Details' => 'è©³çŽ°ãé ã',
-    "Install <a href='http://greasemonkey.mozdev.org/'>GreaseMonkey</a>" => "<a href='http://greasemonkey.mozdev.org/'>GreaseMonkey</a>ã§",
-    "StyleCatcher user script." => "StyleCatcherã®ãŠãŒã¶ãŒã¹ã¯ãªãããå©çšãã",
-    "It will take a moment for themes to populate once you click 'Find Style'." => 'ã¹ã¿ã€ã«æ€çŽ¢ãã¯ãªãã¯ãããšãããŒããåãèŸŒã¿ãŸãïŒå°ãæéãããããŸãïŒã',
-    'Loading...' => 'ã­ãŒãäž­...',
-    'Locally saved themes' => 'ã­ãŒã«ã«ã«ä¿å­ãããããŒã',
-    'More Themes' => 'ãã®ä»ã®ããŒã',
-    'Movable Type styles' => 'Movable Type ã¹ã¿ã€ã«',
-    'NOTE:' => 'æ³š:',
-    ' page.' => 'ããŒãž',
-    'Please click on a theme before attempting to apply a new design to your blog.' => 'ãã­ã°ã«é©çšããããŒããã¯ãªãã¯ããŠéžæããŠãã ããã',
-    'Please select a weblog to apply this theme.' => 'ããŒããé©çšãããã­ã°ãéžæããŠãã ããã',
-    'Saved Themes' => 'ä¿å­æžã¿ããŒã',
-    'Select a Design using StyleCatcher' => 'StyleCatcherã§ãã¶ã€ã³ãéžã¶',
-    'Select a Weblog...' => 'ãã­ã°ãéžæ',
-    'Show Details' => 'è©³çŽ°è¡šç€º',
-    'Single themes from the web' => 'ãã®ä»ã®ããŒã',
-    "StyleCatcher lets you easily browse through styles and then apply them to your blog in just a few clicks. To find out more about Movable Type styles, or for new sources for styles, visit the <a href='http://www.sixapart.com/movabletype/styles'>Movable Type styles</a> page." => "StyleCatcherãäœ¿ããšãã»ãã®æ°åã¯ãªãã¯ããã ãã§ã¹ã¿ã€ã«ãæ¢ããŠãã­ã°ã«é©çšããããšãã§ããŸããMovable Typeã®ã¹ã¿ã€ã«ã«ã€ããŠã®è©³çŽ°ãã¹ã¿ã€ã«ã®é
+	'The selected theme has been applied!' => 'ããŒããé©çšããŸããã',
+	'Error loading themes! -- [_1]' => 'ããŒãã®èª­ã¿èŸŒã¿ã§ãšã©ãŒãçºçããŸãã! -- [_1]',
+	'Stylesheet or Repository URL' => 'ã¹ã¿ã€ã«ã·ãŒããŸãã¯ãªããžããªã®URL',
+	'Stylesheet or Repository URL:' => 'ã¹ã¿ã€ã«ã·ãŒããŸãã¯ãªããžããªã®URL:',
+	'Download Styles' => 'ã¹ã¿ã€ã«ãããŠã³ã­ãŒã',
+	'Current theme for your weblog' => 'é©çšãããŠããããŒã',
+	'Current Style' => 'çŸåšã®ã¹ã¿ã€ã«',
+	'Locally saved themes' => 'ä¿å­ãããŠããããŒã',
+	'Saved Styles' => 'ä¿å­ãããŠããã¹ã¿ã€ã«',
+	'Default Styles' => 'æ¢å®ã®ã¹ã¿ã€ã«',
+	'Single themes from the web' => 'ãã®ä»ã®ããŒã',
+	'More Styles' => 'ãã®ä»ã®ã¹ã¿ã€ã«',
+	'Selected Design' => 'éžæããããã¶ã€ã³',
+	'Layout' => 'ã¬ã€ã¢ãŠã',
+
+## plugins/StyleCatcher/lib/StyleCatcher/CMS.pm
+	'Your mt-static directory could not be found. Please configure \'StaticFilePath\' to continue.' => 'mt-staticãã£ã¬ã¯ããªãèŠã€ãããŸããã§ãããStaticFilePathãèš­å®ããŠãã ããã',
+	'Could not create [_1] folder - Check that your \'themes\' folder is webserver-writable.' => '[_1] ãã©ã«ããäœæã§ããŸããã\'themes\' ãã©ã«ããæžãèŸŒã¿å¯èœãç¢ºèªããŠãã ããã',
+	'Error downloading image: [_1]' => 'ç»åãããŠã³ã­ãŒãã§ããŸããã§ãã: [_1]',
+	'Successfully applied new theme selection.' => 'æ°ããããŒããé©çšããŸããã',
+	'Invalid URL: [_1]' => 'URLãäžæ­£ã§ã: [_1]',
+
+## plugins/StyleCatcher/stylecatcher.pl
+	'StyleCatcher lets you easily browse through styles and then apply them to your blog in just a few clicks. To find out more about Movable Type styles, or for new sources for styles, visit the <a href=\'http://www.sixapart.com/movabletype/styles\'>Movable Type styles</a> page.' => 'StyleCatcherãäœ¿ããšãã»ãã®æ°åã¯ãªãã¯ããã ãã§ã¹ã¿ã€ã«ãæ¢ããŠãã­ã°ã«é©çšããããšãã§ããŸããMovable Typeã®ã¹ã¿ã€ã«ã«ã€ããŠã®è©³çŽ°ãã¹ã¿ã€ã«ã®é
 åžå
-ã«ã€ããŠã¯ã<a href='http://www.sixapart.com/movabletype/styles'>Movable Type styles</a>ã®ããŒãžïŒè±èªïŒãžã¢ã¯ã»ã¹ããŠãã ããã",
-    'StyleCatcher must first be configured system-wide before it can be used.' => 'StyleCatcherãå©çšããã«ã¯ããŸãã·ã¹ãã ã¬ãã«ã§èš­å®ãè¡ãå¿
-èŠããããŸãã',
-    'Style Library URL:' => 'Style Libraryãžã®URL:',
-    'Successfully applied new theme selection.' => 'æ°ããããŒããé©çšããŸããã',
-    'Theme or Repository URL:' => 'ããŒã/ãªããžããªãžã®URL:',
-    'Theme Root Path:' => 'ããŒãã®ã«ãŒããã¹:',
-    'Theme Root URL:' => 'ããŒãã®ã«ãŒãURL:',
-    'The paths defined here must physically exist and be writable by the webserver.' => 'ãã®ãã¹ã¯ç©ççã«å­åšããã€WebãµãŒããŒããæžãèŸŒã¿å¯èœã§ãªããã°ãªããŸããã',
-    ' To change the location of your local theme repository, ' => ' ããŒããªããžããªã®å Žæãå€ããã«ã¯ ',
-    'Unable to create the theme root directory. Error: [_1]' => 'ããŒãã®ã«ãŒããã£ã¬ã¯ããªãäœæã§ããŸããã§ãã: [_1]',
-    'Unable to write base-weblog.css to themeroot. File Manager gave the error: [_1]. Are you sure your theme root directory is web-server writable?' => 'base-weblog.cssãããŒãã®ã«ãŒãã«æžãèŸŒããŸããã§ãã: [_1]ãWebãµãŒããŒããããŒãã®ã«ãŒããã£ã¬ã¯ããªã«æžãèŸŒã¿ãã§ãããã©ããç¢ºèªããŠãã ããã',
-    q{You don't appear to have any weblogs with a 'styles-site.css' template that you have rights to edit. Please check your weblog(s) for this template.} => 'styles-site.cssãã³ãã¬ãŒããå©çšããŠãããã­ã°ããããŸããããã®ãã³ãã¬ãŒãããã­ã°ã§ç¢ºèªããŠãã ããã',
-    q{You must define a global theme repository where themes can be stored locally.  If a particular blog has not been configured for it's own theme paths, it will use these settings. If a blog has it's own theme paths, then the theme will be copied to that location when applied to that weblog.} => 'ããŒããä¿å­ããããã®ã°ã­ãŒãã«ããŒããã£ã¬ã¯ããªãæå®ããŠãã ããããã­ã°ããšã®èš­å®ã§äžæžãããªãéããããã§ã®èš­å®ãå©çšãããŸãããã­ã°ã®èš­å®ã§äžæžãããå ŽåãããŒãã¯ãã­ã°ã«é©çšããããšãã«ãã®å Žæãžã³ããŒãããŸãã',
-    q{Your theme URL and path can be customized for this weblog.} => 'ãã®ãã­ã°çšã«ããŒãã®URLãšãã¹ãã«ã¹ã¿ãã€ãºã§ããŸãã', 
-    "<p>You must define a global theme repository where themes can be stored locally.  If a particular blog has not been configured for it's own theme paths, it will use these settings directly. If a blog has it's own theme paths, then the theme will be copied to that location when applied to that weblog. The paths defined here must physically exist and be writable by the webserver.</p>" => '<p>ããŒããä¿å­ããããã®ã°ã­ãŒãã«ããŒããã£ã¬ã¯ããªãæå®ããŠãã ããããã­ã°ããšã®èš­å®ã§äžæžãããªãéããããã§ã®èš­å®ãå©çšãããŸãããã­ã°ã®èš­å®ã§äžæžãããå ŽåãããŒãã¯ãã­ã°ã«é©çšããããšãã«ãã®å Žæãžã³ããŒãããŸãããã®ãã¹ã¯ç©ççã«å­åšããã€WebãµãŒããŒããæžãèŸŒã¿å¯èœã§ãªããã°ãªããŸããã</p>',
-    '<p style="color: #f00;"><strong>NOTE:</strong> StyleCatcher must first be configured from the system-level plugins listing before it can be used on any blog.</p>' => '<p style="color: #f00;"><strong>æ³šæïŒ</strong>StyleCatcherãå©çšããã«ã¯ããŸãã·ã¹ãã ã¬ãã«ã§èš­å®ãè¡ãå¿
-èŠããããŸãã',
-    "<p>If you wish to store your themes locally for this blog, you can configure your theme URL and path below.  Although downloaded themes will still be stored in the system-level directory, they will be copied to this directory when they are applied. The paths defined here must physically exist and be writable by the webserver.</p>" => '<p>ããŒãã®ãã¡ã€ã«ããã­ã°ããšã«ä¿å­ãããå Žåã¯ãããŒãã®URLãšãã¹ãä»¥äžã«èš­å®ããŠãã ãããããŠã³ã­ãŒããããããŒãã¯ã·ã¹ãã ã¬ãã«ã§èš­å®ãããã£ã¬ã¯ãªã«ä¿å­ãããŸããããã­ã°ã«é©çšããã°ããã§æå®ãããã£ã¬ã¯ããªã«ãã³ããŒãããŸãããã®ãã¹ã¯ç©ççã«å­åšããã€WebãµãŒããŒããæžãèŸŒã¿å¯èœã§ãªããã°ãªããŸããã</p>',
-
-
+ã«ã€ããŠã¯ã<a href=\'http://www.sixapart.com/movabletype/styles\'>Movable Type styles</a>ã®ããŒãžïŒè±èªïŒãžã¢ã¯ã»ã¹ããŠãã ããã',
+	'MT 4 Style Library' => 'MT 4 ã¹ã¿ã€ã«ã©ã€ãã©ãª',
+	'A collection of styles compatible with Movable Type 4 default templates.' => 'Movable Type 4ã®ããã©ã«ããã³ãã¬ãŒããšäºææ§ã®ããã¹ã¿ã€ã«ã§ãã',
+	'MT 3 Style Library' => 'MT 3 ã¹ã¿ã€ã«ã©ã€ãã©ãª',
+	'A collection of styles compatible with Movable Type 3.3+ default templates.' => 'Movable Type 3.3xã®ããã©ã«ããã³ãã¬ãŒããšäºææ§ã®ããã¹ã¿ã€ã«ã§ãã',
+	'Styles' => 'ã¹ã¿ã€ã«',
 );
 
Index: trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/CMS.pm
===================================================================
--- trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/CMS.pm (revision 817)
+++ trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher/CMS.pm (revision 817)
@@ -0,0 +1,690 @@
+# Movable Type (r) Open Source (C) 2005-2008 Six Apart, Ltd.
+# This program is distributed under the terms of the
+# GNU General Public License, version 2.
+#
+# $Id: CMS.pm 2576 2008-06-14 00:35:33Z bchoate $
+
+package StyleCatcher::CMS;
+
+use strict;
+use File::Basename qw(basename);
+
+our $DEFAULT_STYLE_LIBRARY;
+
+sub style_library {
+    return MT->registry("stylecatcher_libraries");
+}
+
+sub file_mgr {
+    my $app = MT->instance;
+    require MT::FileMgr;
+    my $filemgr = MT::FileMgr->new('Local')
+      or return $app->error( MT::FileMgr->errstr );
+    $filemgr;
+}
+
+sub listify {
+    my ($data) = @_;
+    my @list;
+    foreach my $k (keys %$data) {
+        my %entry = %{ $data->{$k} };
+        $entry{key} = $k;
+        delete $entry{plugin};
+        $entry{label} = $entry{label}->() if ref($entry{label});
+        $entry{description_label} = $entry{description_label}->() if ref($entry{description_label});
+        push @list, \%entry;
+    }
+    @list = sort { $a->{order} <=> $b->{order} } @list;
+    \@list;
+}
+
+sub view {
+    my $app     = shift;
+    my $blog_id = $app->param('blog_id');
+    $app->return_to_dashboard( redirect => 1 ) unless $blog_id;
+
+    my $blog = MT::Blog->load($blog_id);
+    return $app->errtrans("Invalid request") unless $blog;
+
+    my $static_path = $app->static_file_path;
+    if (! -d $static_path ) {
+        return $app->errtrans("Your mt-static directory could not be found. Please configure 'StaticFilePath' to continue.");
+    }
+
+    my $themeroot =
+      File::Spec->catdir( $app->static_file_path, 'support', 'themes' );
+    my $webthemeroot = $app->static_path . 'support/themes';
+    my $stylelibrary = listify(style_library());
+    my $theme_data   = make_themes();
+    my $styled_blogs = fetch_blogs();
+
+    my $config = plugin()->get_config_hash();
+
+    my @blog_loop;
+    my %current_themes;
+    my ($blog_theme, $blog_layout);
+    foreach my $blog (@$styled_blogs) {
+        my $curr_theme = $config->{"current_theme_" . $blog->id} || '';
+        my $curr_layout = $config->{"current_layout_" . $blog->id} || 'layout-wtt';
+        push @blog_loop,
+          {
+            blog_id   => $blog->id,
+            blog_name => $blog->name,
+            layout    => $curr_layout,
+            theme_id  => $curr_theme,
+            view_link => $blog->site_url,
+          };
+        if ($blog->id == $blog_id) {
+            $blog_theme = $curr_theme;
+            $blog_layout = $curr_layout;
+        }
+        if ( $theme_data->{themes} && $curr_theme ) {
+            foreach my $theme ( @{ $theme_data->{themes} } ) {
+                if ( ($theme->{prefix} || '') . ':' . $theme->{name} eq $curr_theme ) {
+                    push @{ $theme->{blogs} }, $blog->id;
+                    next if exists $current_themes{ $theme->{name} };
+                    $current_themes{ $theme->{name} } = 1;
+                    push @{ $theme->{tags} }, 'collection:current';
+                }
+            }
+        }
+    }
+
+    push @{ $theme_data->{categories} }, 'current'
+      if %current_themes;
+
+    require JSON;
+    my $url   = $app->param('url');
+    my %param = (
+        version     => plugin()->version,
+        # blog_loop   => \@blog_loop,
+        blog_id => $blog_id,
+        themes_json => JSON::objToJson(
+            $theme_data, { pretty => 1, indent => 2, delimiter => 1 }
+        ),
+        auto_fetch => $url ? 1 : 0,
+        style_library => $stylelibrary,
+        current_theme => $blog_theme || '',
+        current_layout => $blog_layout || 'layout-wtt',
+        dynamic_blog => (($blog->custom_dynamic_templates || '') eq 'all'),
+    );
+
+    if ( $blog_id && @$styled_blogs ) {
+        my $blog = $styled_blogs->[0];
+        $param{blog_name} = $blog->name;
+        $param{blog_url}  = $blog->site_url;
+    }
+
+    my $path = $app->static_path;
+    $path .= '/' unless $path =~ m!/$!;
+    $path .= plugin()->envelope . "/";
+    $path = $app->base . $path if $path =~ m!^/!;
+    $param{plugin_static_uri} = $path;
+
+    $app->build_page( 'view.tmpl', \%param );
+}
+
+# AJAX/JSON modes
+
+# returns a json structure of styles given a particular url
+sub js {
+    # ydnar's remixer uses javascript files for each collection of styles -
+    # we generate these js files from css metadata
+    # StyleCatcher will pick up any metadata in the theme css file in the
+    # format of 'key: value' in comment-space
+    # The remixer only uses name, author, description at the moment.
+    my $app = shift;
+
+    my $data = fetch_themes($app->param('url'))
+        or return $app->json_error( $app->errstr );
+    return $app->json_result( $data );
+}
+
+# does the work after user selects a particular theme to apply to a blog
+sub apply {
+    my $app = shift;
+
+    my $blog_id = $app->param('blog_id');
+    my $url     = $app->param('url');
+    my $layout  = $app->param('layout');
+    my $name    = $app->param('name');
+
+    # Load the default stylesheet for this blog
+    my $tmpl = load_style_template($blog_id);
+
+    $app->validate_magic or return $app->json_error($app->translate("Invalid request"));
+    return $app->json_error($app->translate("Invalid request"))
+      unless $blog_id && $url && $tmpl;
+
+    my $static_path = $app->static_file_path;
+    if (! -d $static_path ) {
+        return $app->json_error($app->translate("Your mt-static directory could not be found. Please configure 'StaticFilePath' to continue."));
+    }
+
+    my $themeroot =
+      File::Spec->catdir( $static_path, 'support', 'themes' );
+    my $webthemeroot = $app->static_path . 'support/themes/';
+    my $mtthemeroot  = $app->static_path . 'themes/';
+    my $mtthemebase  = $app->static_path . 'themes-base/';
+
+    # Break up the css url in to a couple useful pieces
+    my @url = split( /\//, $url );
+
+    # if this isn't a local url, then we have to grab some files from
+    # yonder...
+    my $filemgr = file_mgr()
+      or return $app->json_error( MT::FileMgr->errstr );
+
+    if ( $url !~ m/^(\Q$webthemeroot\E|\Q$mtthemeroot\E)/ ) {
+        my $new_url = '';
+
+        for (0..(scalar(@url)-2)) {
+            $new_url .= $url[$_] . '/';
+        }
+        my ( $basename, $extension ) = split( /\./, $url[-1] );
+        if ($basename eq 'screen') {
+            $basename = $url[-2];
+        }
+
+        # Pick up the stylesheet
+        my $user_agent  = $app->new_ua;
+        my $css_request = HTTP::Request->new( GET => $url );
+        my $response    = $user_agent->request($css_request);
+
+        # Pick up the thumbnail and thumbnail-large
+        my $thumbnail_request =
+          HTTP::Request->new( GET => $new_url . "thumbnail.gif" );
+        my $thumbnail_response = $user_agent->request($thumbnail_request);
+        my $thumbnail_large_request =
+          HTTP::Request->new( GET => $new_url . "thumbnail-large.gif" );
+        my $thumbnail_large_response =
+          $user_agent->request($thumbnail_large_request);
+
+        # Parse out image filenames in the css and then write out the css file
+        # and thumbnails to our theme folder
+        my $content = $response->content;
+        $content =~ s!/\*.*?\*/!!gs;    # strip all comments first
+        my @images = $content =~
+          m/\b(?:url\(\s*)([a-zA-Z0-9_.-]+\.(?:gif|jpe?g|png))(?:\s*?\))/gi;
+        $filemgr->mkpath( File::Spec->catdir( $themeroot, $basename ) )
+          or return $app->json_error(
+            $app->translate(
+"Could not create [_1] folder - Check that your 'themes' folder is webserver-writable.",
+                $basename
+            )
+          );
+        $filemgr->put_data( $response->content,
+            File::Spec->catfile( $themeroot, $basename, $basename . '.css' ) );
+        if (($thumbnail_response->code >= 200) && ($thumbnail_response->code < 400)) {
+        $filemgr->put_data( $thumbnail_response->content,
+            File::Spec->catfile( $themeroot, $basename, "thumbnail.gif" ),
+            'upload' );
+        } else {
+            return $app->json_error($app->translate("Error downloading image: [_1]", $new_url . 'thumbnail.gif'))
+        }
+        if (($thumbnail_large_response->code >= 200) && ($thumbnail_large_response->code < 400)) {
+            $filemgr->put_data(
+                $thumbnail_large_response->content,
+                File::Spec->catfile( $themeroot, $basename, "thumbnail-large.gif" ),
+                'upload'
+            );
+        } else {
+            return $app->json_error($app->translate("Error downloading image: [_1]", $new_url . 'thumbnail-large.gif'))
+        }
+
+       # Pick up the images we parsed earlier and write them to the theme folder
+        for my $image_url (@images) {
+            my $image_request =
+              HTTP::Request->new( GET => $new_url . $image_url );
+            my $image_response = $user_agent->request($image_request);
+
+            my @image_url = split( /\//, $image_url );
+            my $image_filename = $image_url[-1];
+
+            if (($response->code >= 200) && ($response->code < 400)) {
+                $filemgr->put_data( $image_response->content,
+                    File::Spec->catfile( $themeroot, $basename, $image_filename ),
+                    'upload' )
+                  or return $app->json_error( $filemgr->errstr );
+            } else {
+                return $app->json_error($app->translate("Error downloading image: [_1]", $new_url . $image_url));
+            }
+        }
+        $url = "$webthemeroot$basename/$basename.css";
+    }
+    
+
+    my $url2 = $mtthemebase . "blog.css";
+
+    # Replacing the theme import or adding a new one at the beginning
+    my $template_text  = $tmpl->text();
+    my $replaced       = 0;
+    my $header =
+'/* This is the StyleCatcher theme addition. Do not remove this block. */';
+    my $footer = '/* end StyleCatcher imports */';
+    my $styles = $header . "\n" . <<"EOT" . $footer;
+\@import url($url2);
+\@import url($url);
+EOT
+    if ($template_text =~ s/\Q$header\E.*\Q$footer\E/$styles/s) {
+        $tmpl->text( $template_text );
+        $replaced = 1;
+    }
+    unless ($replaced) {
+
+        # we're dealing with a template that wasn't modified before now
+        # we will need to backup the existing one to make sure the new
+        # style is applied properly.
+        my @ts = MT::Util::offset_time_list( time, $blog_id );
+        my $ts = sprintf "%04d-%02d-%02d %02d:%02d:%02d", $ts[5] + 1900,
+          $ts[4] + 1, @ts[ 3, 2, 1, 0 ];
+        my $backup = $tmpl->clone;
+        delete $backup->{column_values}
+          {id};    # make sure we don't overwrite original
+        delete $backup->{changed_cols}{id};
+        $backup->name( $backup->name . ' (Backup from ' . $ts . ')' );
+        $backup->outfile('');
+        $backup->linked_file( $tmpl->linked_file );
+        $backup->rebuild_me(0);
+        $backup->build_dynamic(0);
+        $backup->identifier(undef);
+        $backup->type('backup');
+        $backup->save;
+        $tmpl->linked_file('');    # make sure this one isn't linked now
+        $tmpl->identifier('styles');
+        $tmpl->text($styles);
+    }
+
+    # Putting the stylesheet back together again
+    $tmpl->save or return $app->json_error( $tmpl->errstr );
+
+    my $blog = MT->model('blog')->load($blog_id)    
+      or return $app->json_error( $app->translate('No such blog [_1]', $blog_id) );
+    $blog->page_layout($layout);
+    $blog->touch();
+    $blog->save();
+
+    # rebuild only the stylesheet! forcibly. with prejudice.
+    $app->rebuild_indexes(
+        BlogID   => $tmpl->blog_id,
+        Template => $tmpl,
+        Force    => 1
+    );
+
+    my $p = plugin();
+    $name =~ s/^repo_\d+:/local:/;
+    $name =~ s/\.css$//;
+    $p->set_config_value('current_theme_' . $blog_id, $name);
+    if ($layout) {
+        $p->set_config_value('current_layout_' . $blog_id, $layout);
+    } else {
+        $p->set_config_value('current_layout_' . $blog_id, undef);
+    }
+
+    return $app->json_result(
+        {
+            message =>
+              $app->translate("Successfully applied new theme selection.")
+        }
+    );
+}
+
+# Utility methods
+
+sub fetch_blogs {
+    my $app     = MT->app;
+    my $user    = $app->user;
+    my $blog_id = $app->param('blog_id');
+
+    my @blogs;
+    if ($blog_id) {
+        @blogs = MT::Blog->load($blog_id);
+    } else {
+        if ( $user->is_superuser() ) {
+            if ($blog_id) {
+                @blogs = MT::Blog->load($blog_id);
+            }
+        }
+        else {
+            my $args = { author_id => $user->id };
+            $args->{blog_id} = $blog_id if $blog_id;
+            require MT::Permission;
+            my @perms = MT::Permission->load( { author_id => $user->id } );
+            foreach my $perm (@perms) {
+                next unless $perm->can_edit_templates;
+                push @blogs, MT::Blog->load( $perm->blog_id );
+            }
+        }
+    }
+    my @styled_blogs;
+    foreach my $blog (@blogs) {
+        my $tmpl = load_style_template( $blog->id );
+        if ($tmpl) {
+            push @styled_blogs, $blog;
+        }
+    }
+    @styled_blogs = sort { $a->name cmp $b->name } @styled_blogs;
+
+    \@styled_blogs;
+}
+
+sub load_style_template {
+    my ($blog_id) = @_;
+
+    require MT::Template;
+    my $tmpl;
+
+    $tmpl = MT::Template->load(
+        {
+            blog_id    => $blog_id,
+            identifier => 'styles'
+        }
+    );
+
+    $tmpl ||= MT::Template->load(
+        {
+            blog_id => $blog_id,
+            outfile => "styles.css"
+        }
+    );
+
+    # MT 3.x era stylesheet file
+    $tmpl ||= MT::Template->load(
+        {
+            blog_id => $blog_id,
+            outfile => "styles-site.css"
+        }
+    );
+
+    unless ($tmpl) {
+
+        # Create one since we didn't find a candidate
+        $tmpl = new MT::Template;
+        $tmpl->blog_id($blog_id);
+        $tmpl->identifier('styles');
+        $tmpl->outfile("styles.css");
+        $tmpl->text(<<'EOT');
+@import url(<$MTStaticWebPath$>themes-base/blog.css);
+@import url(<$MTStaticWebPath$>themes/minimalist-red/styles.css);
+EOT
+        $tmpl->save();
+    }
+
+    $tmpl;
+}
+
+# pulls a list of themes available from a particular url
+sub fetch_themes {
+    my $app = MT->app;
+    my ($url) = @_;
+    return undef unless $url;
+
+    my $blog_id = $app->param('blog_id');
+    my $data    = {};
+
+  # If we have a url then we're specifying a specific theme (css) or repo (html)
+    # Pick up the file (html with <link>s or a css file with metadata)
+    my $user_agent = $app->new_ua;
+    my $request    = HTTP::Request->new( GET => $url );
+    my $response   = $user_agent->request($request);
+
+    # Make a repo if you've got a ton of links or an automagic entry if
+    # you're a css file
+    my $type = $response->headers->{'content-type'};
+    $type = shift @$type if ref $type eq 'ARRAY';
+    if ( $type =~ m!^text/css! ) {
+        $data->{auto}{url} = $url;
+        my $theme = fetch_theme( $url, ['collection:auto'] );
+        $data->{themes} = [$theme];
+    }
+    elsif ( $type =~ m!^text/html! ) {
+        my @repo_themes;
+        for my $link (
+            ref( $response->headers->{'link'} ) eq 'ARRAY'
+            ? @{ $response->headers->{'link'} }
+            : $response->headers->{'link'}
+          )
+        {
+            my ( $css, @parsed_link ) = split( /;/, $link );
+            $css =~ s/[<>]//g;
+            my %attr;
+            foreach (@parsed_link) {
+                my ( $name, $val ) = split /=/, $_, 2;
+                $name =~ s/^ //;
+                $val  =~ s/^['"]|['"]$//g;
+                next if $name eq '/';
+                $attr{ lc($name) } = $val;
+            }
+            next unless lc $attr{rel}  eq 'theme';
+            next unless lc $attr{type} eq 'text/x-theme';
+
+            # Fix for relative theme locations
+            if ($css !~ m!^https?://!) {
+                my $new_css = $url;
+                $new_css =~ s!/[a-z0-9_-]+\.[a-z]+?$|/$!/!;
+                $new_css .= $css;
+                $css = $new_css;
+            }
+            push @repo_themes, $css;
+        }
+
+        my $themes = [];
+        for my $repo_theme (@repo_themes) {
+            my $theme = fetch_theme( $repo_theme, [] );
+            push @$themes, $theme if $theme;
+        }
+        $data->{themes} = $themes;
+        if ( $data->{repo}{display_name} = $response->headers->{'title'} ) {
+            $data->{repo}{name} =
+              MT::Util::dirify( $data->{repo}{display_name} );
+        }
+        else {
+            $data->{repo}{display_name} = $url;
+            $data->{repo}{name}         = MT::Util::dirify($url);
+        }
+        $data->{repo}{url} = $url;
+    }
+    else {
+        return $app->error( $app->translate('Invalid URL: [_1]', $url) );
+    }
+
+    $data;
+}
+
+# sets up the object structure we return through json to populate
+# the mixer.
+sub make_themes {
+    my $app = MT->instance;
+
+    # categories
+    #   current    (for active theme)
+    #   repo       (for themes found at repo link)
+    #   my-designs (for themes that are stored locally)
+    #   mt-designs (for themes that are local and installed by default)
+    #   auto       (for link to a single css file)
+
+    # structure of "data"
+    #   categories => [ one, two, three ]  ie: 'current', 'repo'
+    #   themes => [
+    #       { theme }
+    #   ]
+    #   repo => {
+    #       display_name => 'display name',
+    #       name => 'repo name',
+    #       url => 'url of repo',
+    #   }
+
+# structure of "theme"
+#   theme => {
+#       name => 'theme_dir',
+#       imageSmall => 'link_to/thumbnail.gif',
+#       imageBig => 'link_to/thumbnail-large.gif',
+#       title => 'Theme Title',
+#       description => 'Theme description.',
+#       url_css => 'link_to/theme.css',
+#       url_zip => 'link_to/theme.zip',
+#       author => 'Author Name',
+#       author_url => 'http://author.com/'
+#       author_affiliation => 'Author Co.',
+#       layouts => "comma,delimited,layout,list"
+#       sort => 'theme_sortable_name',
+#       tags => ['association:tag']  ie, 'color:blue', 'designer:author', 'collection:repo'
+#   }
+
+    my ( $categories, $themes );
+    my $sys_root = File::Spec->catdir( $app->static_file_path, 'themes' );
+
+    # Generate our list of themes within the themeroot directory
+    my @sys_list = glob( File::Spec->catfile( $sys_root, "*" ) );
+    $categories->{'mt-designs'} = 1 if @sys_list;
+    for my $theme (@sys_list) {
+        my $theme_dir = $theme;
+        my $theme_url = $app->static_path . 'themes';
+        next unless -d $theme;
+        $theme =~ s/.*[\\\/]//;
+        $themes->{$theme} =
+          fetch_theme( $theme_dir, ['collection:mt-designs'], $theme_url,
+            $theme_dir );
+        $themes->{$theme}{name} = $themes->{$theme}{name};
+        $themes->{$theme}{prefix} = 'default';
+    }
+
+    my $themeroot =
+      File::Spec->catdir( $app->static_file_path, 'support', 'themes' );
+
+    # Generate our list of themes within the themeroot directory
+    my @themeroot_list = glob( File::Spec->catfile( $themeroot, "*" ) );
+    $categories->{'my-designs'} = 1 if @themeroot_list;
+    for my $theme (@themeroot_list) {
+        my $theme_dir = $theme;
+        next unless -d $theme;
+        $theme =~ s/.*[\\\/]//;
+        $themes->{$theme} =
+          fetch_theme( $theme_dir, ['collection:my-designs'] );
+        $themes->{$theme}{prefix} = 'local';
+    }
+
+    my $data = {
+        categories => [ keys %$categories ],
+        themes     => [ values %$themes ]
+    };
+
+    $data;
+}
+
+sub fetch_theme {
+    my $app = MT->app;
+    my ( $url, $tags, $baseurl, $basepath ) = @_;
+
+    my $theme;
+    my $stylesheet;
+    my $new_url;
+    my $themeroot;
+    if ( $url =~ m/^https?:/i ) {
+
+        # Pick up the css file
+        my $user_agent  = $app->new_ua;
+        my $css_request = HTTP::Request->new( GET => $url );
+        my $response    = $user_agent->request($css_request);
+        $stylesheet = $response->content if ($response->code >= 200) && ($response->code < 400);
+        return unless $stylesheet;
+
+# Break up the css url in to a couple useful pieces (generalize and break me out)
+        $theme = $url;
+        # discard any generic 'screen.css' filename
+        $theme =~ s!/screen.css$!!;
+        $theme =~ s/.*[\\\/]//;
+        my @url = split( /\//, $url );
+        for ( 0 .. ( scalar(@url) - 2 ) ) {
+            $new_url .= $url[$_] . '/';
+        }
+    }
+    else {
+        $themeroot = $basepath
+          || File::Spec->catdir( $app->static_file_path, 'support', 'themes' );
+        my $webthemeroot = $baseurl || $app->static_path . 'support/themes';
+
+        $theme = $url;
+        $theme =~ s/.*[\\\/]//;
+        my $file = File::Spec->catfile( $url, "$theme.css" );
+        $new_url = "$webthemeroot/$theme/";
+        if ( -e $file ) {
+            $stylesheet = file_mgr()->get_data($file);
+            $url        = $new_url . "$theme.css";
+        }
+        else {
+            $file = File::Spec->catfile( $url, "screen.css" );
+            if ( -e $file ) {
+                $stylesheet = file_mgr()->get_data($file);
+                $url        = $new_url . "screen.css";
+            }
+        }
+    }
+
+    # Pick up the metadata from the css
+    my @css_lines = split( /\r?\n/, $stylesheet || '' );
+    my $commented = 0;
+    my @comments;
+    for my $line (@css_lines) {
+        my $pos;
+        $pos = index( $line, "/*" );
+        unless ( $pos == -1 ) {
+            $line = substr( $line, $pos + 2 );
+            $commented = 1;
+        }
+        if ($commented) {
+            $pos = index( $line, "*/" );
+            unless ( $pos == -1 ) {
+                $line = substr( $line, 0, $pos );
+                $commented = 0;
+            }
+            push @comments, $line;
+        }
+    }
+
+    my $comment;
+    my %metadata;
+
+    # Trim me white space, yarr
+    for (@comments) {
+
+        # TBD: strip any "risky" content; we don't want any
+        # XSS in this content.
+        # Strip any null bytes
+        tr/\x00//d;
+        s/^\s+|\s+$//g;
+        my ( $key, $value ) = split( /:/, $_, 2 ) or next;
+        next unless defined $value;
+        $value =~ s/^\s+//;
+        $metadata{ lc $key } = $value;
+    }
+
+    my $thumbnail_link;
+    $thumbnail_link = $new_url . 'thumbnail.gif';
+    my $thumbnail_large_link;
+    $thumbnail_large_link = $new_url . 'thumbnail-large.gif';
+
+    require MT::Util;
+    my $data = {
+        name        => $theme,
+        description => $metadata{description} || '',
+        title       => $metadata{name} || '(Untitled)',
+        url         => $url,
+        imageSmall  => $thumbnail_link,
+        imageBig    => $thumbnail_large_link,
+        author      => $metadata{designer} || $metadata{author} || '',
+        author_url  => $metadata{designer_url} || $metadata{author_url} || '',
+        author_affiliation => $metadata{author_affiliation} || '',
+        layouts            => $metadata{layouts} || '',
+        'sort'             => $metadata{name} || '',
+        tags               => $tags,
+        blogs              => [],
+    };
+    $data;
+}
+
+sub plugin {
+    return MT->component('StyleCatcher');
+}
+
+1;
