Browse Source

Remove the need for a LC_MESSAGES folder.

ADmad 11 years ago
parent
commit
80e5055df7
43 changed files with 5 additions and 5 deletions
  1. 1 1
      src/I18n/MessagesFileLoader.php
  2. 4 4
      tests/TestCase/I18n/Parser/PoFileParserTest.php
  3. 0 0
      tests/test_app/Plugin/TestPlugin/src/Locale/en/test_plugin.po
  4. 0 0
      tests/test_app/TestApp/Locale/cache_test_po/default.po
  5. 0 0
      tests/test_app/TestApp/Locale/cache_test_po/dom1.po
  6. 0 0
      tests/test_app/TestApp/Locale/cache_test_po/dom2.po
  7. 0 0
      tests/test_app/TestApp/Locale/en/default.po
  8. 0 0
      tests/test_app/TestApp/Locale/en/special.po
  9. 0 0
      tests/test_app/TestApp/Locale/en/validation_messages.po
  10. 0 0
      tests/test_app/TestApp/Locale/es/default.mo
  11. 0 0
      tests/test_app/TestApp/Locale/nld/default.po
  12. 0 0
      tests/test_app/TestApp/Locale/rule_0_mo/core.mo
  13. 0 0
      tests/test_app/TestApp/Locale/rule_0_mo/default.mo
  14. 0 0
      tests/test_app/TestApp/Locale/rule_0_po/core.po
  15. 0 0
      tests/test_app/TestApp/Locale/rule_0_po/default.po
  16. 0 0
      tests/test_app/TestApp/Locale/rule_10_po/core.po
  17. 0 0
      tests/test_app/TestApp/Locale/rule_10_po/default.po
  18. 0 0
      tests/test_app/TestApp/Locale/rule_11_po/core.po
  19. 0 0
      tests/test_app/TestApp/Locale/rule_11_po/default.po
  20. 0 0
      tests/test_app/TestApp/Locale/rule_12_po/core.po
  21. 0 0
      tests/test_app/TestApp/Locale/rule_12_po/default.po
  22. 0 0
      tests/test_app/TestApp/Locale/rule_13_po/core.po
  23. 0 0
      tests/test_app/TestApp/Locale/rule_13_po/default.po
  24. 0 0
      tests/test_app/TestApp/Locale/rule_14_po/core.po
  25. 0 0
      tests/test_app/TestApp/Locale/rule_14_po/default.po
  26. 0 0
      tests/test_app/TestApp/Locale/rule_1_po/core.po
  27. 0 0
      tests/test_app/TestApp/Locale/rule_1_po/default.po
  28. 0 0
      tests/test_app/TestApp/Locale/rule_2_po/core.po
  29. 0 0
      tests/test_app/TestApp/Locale/rule_2_po/default.po
  30. 0 0
      tests/test_app/TestApp/Locale/rule_3_po/core.po
  31. 0 0
      tests/test_app/TestApp/Locale/rule_3_po/default.po
  32. 0 0
      tests/test_app/TestApp/Locale/rule_4_po/core.po
  33. 0 0
      tests/test_app/TestApp/Locale/rule_4_po/default.po
  34. 0 0
      tests/test_app/TestApp/Locale/rule_5_po/core.po
  35. 0 0
      tests/test_app/TestApp/Locale/rule_5_po/default.po
  36. 0 0
      tests/test_app/TestApp/Locale/rule_6_po/core.po
  37. 0 0
      tests/test_app/TestApp/Locale/rule_6_po/default.po
  38. 0 0
      tests/test_app/TestApp/Locale/rule_7_po/core.po
  39. 0 0
      tests/test_app/TestApp/Locale/rule_7_po/default.po
  40. 0 0
      tests/test_app/TestApp/Locale/rule_8_po/core.po
  41. 0 0
      tests/test_app/TestApp/Locale/rule_8_po/default.po
  42. 0 0
      tests/test_app/TestApp/Locale/rule_9_po/core.po
  43. 0 0
      tests/test_app/TestApp/Locale/rule_9_po/default.po

+ 1 - 1
src/I18n/MessagesFileLoader.php

@@ -123,7 +123,7 @@ class MessagesFileLoader {
 		}
 
 		foreach ($folders as $folder) {
-			$path = $basePath . $folder . DS . 'LC_MESSAGES' . DS;
+			$path = $basePath . $folder . DS;
 			if (is_dir($path)) {
 				return $path;
 			}

+ 4 - 4
tests/TestCase/I18n/Parser/PoFileParserTest.php

@@ -30,15 +30,15 @@ class PoFileParserTest extends TestCase {
  */
 	public function testParse() {
 		$parser = new PoFileParser;
-		$file = APP . 'Locale' . DS . 'rule_1_po' . DS . 'LC_MESSAGES' . DS . 'default.po';
+		$file = APP . 'Locale' . DS . 'rule_1_po' . DS . 'default.po';
 		$messages = $parser->parse($file);
 		$this->assertCount(5, $messages);
 		$expected = [
 			'Plural Rule 1' => 'Plural Rule 1 (translated)',
 			'%d = 1' => '%d = 1 (translated)',
 			'%d = 0 or > 1' => [
-				 0 => '%d = 1 (translated)',
-				 1 => '%d = 0 or > 1 (translated)'
+				0 => '%d = 1 (translated)',
+				1 => '%d = 0 or > 1 (translated)'
 			],
 			'%-5d = 1' => '%-5d = 1 (translated)',
 			'%-5d = 0 or > 1' => [
@@ -59,7 +59,7 @@ class PoFileParserTest extends TestCase {
  */
 	public function testParseMultiLine() {
 		$parser = new PoFileParser;
-		$file = APP . 'Locale' . DS . 'en' . DS . 'LC_MESSAGES' . DS . 'default.po';
+		$file = APP . 'Locale' . DS . 'en' . DS . 'default.po';
 		$messages = $parser->parse($file);
 		$this->assertCount(12, $messages);
 		$this->assertTextEquals("v\nsecond line", $messages["valid\nsecond line"]);

tests/test_app/Plugin/TestPlugin/src/Locale/en/LC_MESSAGES/test_plugin.po → tests/test_app/Plugin/TestPlugin/src/Locale/en/test_plugin.po


tests/test_app/TestApp/Locale/cache_test_po/LC_MESSAGES/default.po → tests/test_app/TestApp/Locale/cache_test_po/default.po


tests/test_app/TestApp/Locale/cache_test_po/LC_MESSAGES/dom1.po → tests/test_app/TestApp/Locale/cache_test_po/dom1.po


tests/test_app/TestApp/Locale/cache_test_po/LC_MESSAGES/dom2.po → tests/test_app/TestApp/Locale/cache_test_po/dom2.po


tests/test_app/TestApp/Locale/en/LC_MESSAGES/default.po → tests/test_app/TestApp/Locale/en/default.po


tests/test_app/TestApp/Locale/en/LC_MESSAGES/special.po → tests/test_app/TestApp/Locale/en/special.po


tests/test_app/TestApp/Locale/en/LC_MESSAGES/validation_messages.po → tests/test_app/TestApp/Locale/en/validation_messages.po


tests/test_app/TestApp/Locale/es/LC_MESSAGES/default.mo → tests/test_app/TestApp/Locale/es/default.mo


tests/test_app/TestApp/Locale/nld/LC_MESSAGES/default.po → tests/test_app/TestApp/Locale/nld/default.po


tests/test_app/TestApp/Locale/rule_0_mo/LC_MESSAGES/core.mo → tests/test_app/TestApp/Locale/rule_0_mo/core.mo


tests/test_app/TestApp/Locale/rule_0_mo/LC_MESSAGES/default.mo → tests/test_app/TestApp/Locale/rule_0_mo/default.mo


tests/test_app/TestApp/Locale/rule_0_po/LC_MESSAGES/core.po → tests/test_app/TestApp/Locale/rule_0_po/core.po


tests/test_app/TestApp/Locale/rule_0_po/LC_MESSAGES/default.po → tests/test_app/TestApp/Locale/rule_0_po/default.po


tests/test_app/TestApp/Locale/rule_10_po/LC_MESSAGES/core.po → tests/test_app/TestApp/Locale/rule_10_po/core.po


tests/test_app/TestApp/Locale/rule_10_po/LC_MESSAGES/default.po → tests/test_app/TestApp/Locale/rule_10_po/default.po


tests/test_app/TestApp/Locale/rule_11_po/LC_MESSAGES/core.po → tests/test_app/TestApp/Locale/rule_11_po/core.po


tests/test_app/TestApp/Locale/rule_11_po/LC_MESSAGES/default.po → tests/test_app/TestApp/Locale/rule_11_po/default.po


tests/test_app/TestApp/Locale/rule_12_po/LC_MESSAGES/core.po → tests/test_app/TestApp/Locale/rule_12_po/core.po


tests/test_app/TestApp/Locale/rule_12_po/LC_MESSAGES/default.po → tests/test_app/TestApp/Locale/rule_12_po/default.po


tests/test_app/TestApp/Locale/rule_13_po/LC_MESSAGES/core.po → tests/test_app/TestApp/Locale/rule_13_po/core.po


tests/test_app/TestApp/Locale/rule_13_po/LC_MESSAGES/default.po → tests/test_app/TestApp/Locale/rule_13_po/default.po


tests/test_app/TestApp/Locale/rule_14_po/LC_MESSAGES/core.po → tests/test_app/TestApp/Locale/rule_14_po/core.po


tests/test_app/TestApp/Locale/rule_14_po/LC_MESSAGES/default.po → tests/test_app/TestApp/Locale/rule_14_po/default.po


tests/test_app/TestApp/Locale/rule_1_po/LC_MESSAGES/core.po → tests/test_app/TestApp/Locale/rule_1_po/core.po


tests/test_app/TestApp/Locale/rule_1_po/LC_MESSAGES/default.po → tests/test_app/TestApp/Locale/rule_1_po/default.po


tests/test_app/TestApp/Locale/rule_2_po/LC_MESSAGES/core.po → tests/test_app/TestApp/Locale/rule_2_po/core.po


tests/test_app/TestApp/Locale/rule_2_po/LC_MESSAGES/default.po → tests/test_app/TestApp/Locale/rule_2_po/default.po


tests/test_app/TestApp/Locale/rule_3_po/LC_MESSAGES/core.po → tests/test_app/TestApp/Locale/rule_3_po/core.po


tests/test_app/TestApp/Locale/rule_3_po/LC_MESSAGES/default.po → tests/test_app/TestApp/Locale/rule_3_po/default.po


tests/test_app/TestApp/Locale/rule_4_po/LC_MESSAGES/core.po → tests/test_app/TestApp/Locale/rule_4_po/core.po


tests/test_app/TestApp/Locale/rule_4_po/LC_MESSAGES/default.po → tests/test_app/TestApp/Locale/rule_4_po/default.po


tests/test_app/TestApp/Locale/rule_5_po/LC_MESSAGES/core.po → tests/test_app/TestApp/Locale/rule_5_po/core.po


tests/test_app/TestApp/Locale/rule_5_po/LC_MESSAGES/default.po → tests/test_app/TestApp/Locale/rule_5_po/default.po


tests/test_app/TestApp/Locale/rule_6_po/LC_MESSAGES/core.po → tests/test_app/TestApp/Locale/rule_6_po/core.po


tests/test_app/TestApp/Locale/rule_6_po/LC_MESSAGES/default.po → tests/test_app/TestApp/Locale/rule_6_po/default.po


tests/test_app/TestApp/Locale/rule_7_po/LC_MESSAGES/core.po → tests/test_app/TestApp/Locale/rule_7_po/core.po


tests/test_app/TestApp/Locale/rule_7_po/LC_MESSAGES/default.po → tests/test_app/TestApp/Locale/rule_7_po/default.po


tests/test_app/TestApp/Locale/rule_8_po/LC_MESSAGES/core.po → tests/test_app/TestApp/Locale/rule_8_po/core.po


tests/test_app/TestApp/Locale/rule_8_po/LC_MESSAGES/default.po → tests/test_app/TestApp/Locale/rule_8_po/default.po


tests/test_app/TestApp/Locale/rule_9_po/LC_MESSAGES/core.po → tests/test_app/TestApp/Locale/rule_9_po/core.po


tests/test_app/TestApp/Locale/rule_9_po/LC_MESSAGES/default.po → tests/test_app/TestApp/Locale/rule_9_po/default.po