From 8baeead4fc4f257a0fe77412e5e813d477b91e81 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 14 Aug 2009 07:09:37 -0400 Subject: [PATCH] rename a language locally --- classes/WhatDidTheySayAdmin.php | 7 +++++++ test/WhatDidTheySayAdminTest.php | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/classes/WhatDidTheySayAdmin.php b/classes/WhatDidTheySayAdmin.php index d694905..25f64bf 100644 --- a/classes/WhatDidTheySayAdmin.php +++ b/classes/WhatDidTheySayAdmin.php @@ -65,6 +65,13 @@ class WhatDidTheySayAdmin { } } break; + case "rename": + if (isset($options['languages'][$language_info['code']])) { + if (!empty($language_info['name'])) { + $options['languages'][$language_info['code']]['name'] = $language_info['name']; + } + } + break; } update_option('what-did-they-say-options', $options); } diff --git a/test/WhatDidTheySayAdminTest.php b/test/WhatDidTheySayAdminTest.php index 9c5b31d..3f8889e 100644 --- a/test/WhatDidTheySayAdminTest.php +++ b/test/WhatDidTheySayAdminTest.php @@ -32,6 +32,11 @@ class WhatDidTheySayAdminTest extends PHPUnit_Framework_TestCase { array('code' => 'de', 'action' => 'default'), array('en' => array('name' => 'English'), 'de' => array('name' => 'German', 'default' => true)), ), + array( + array('en' => array('name' => 'English'), 'de' => array('name' => 'German')), + array('code' => 'de', 'action' => 'rename', 'name' => 'Deutsch'), + array('en' => array('name' => 'English'), 'de' => array('name' => 'Deutsch')), + ), ); }