r82631 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82630‎ | r82631 | r82632 >
Date:21:04, 22 February 2011
Author:husky
Status:deferred (Comments)
Tags:
Comment:
trying to add translations
Modified paths:
  • /trunk/tools/wp-photocommons/inc/class-photocommons.php (modified) (history)
  • /trunk/tools/wp-photocommons/js/admin.js (modified) (history)
  • /trunk/tools/wp-photocommons/js/translations.php (added) (history)
  • /trunk/tools/wp-photocommons/search.php (modified) (history)

Diff [purge]

Index: trunk/tools/wp-photocommons/inc/class-photocommons.php
@@ -18,6 +18,7 @@
1919 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2020 */
2121 class PhotoCommons {
 22+ const PLUGIN = "wp-photocommons";
2223 const PLUGIN_PATH = '/wp-photocommons/';
2324 const FILEPATH_PATTERN = 'http://commons.wikimedia.org/w/index.php?title=Special:FilePath&file=%s&width=%s';
2425 const FILEPAGE_PATTERN = 'http://commons.wikimedia.org/w/index.php?title=File:%s';
@@ -61,6 +62,7 @@
6263
6364 private function enqueue_scripts() {
6465 // Register some of our own scripts
 66+ wp_register_script( 'translations', plugins_url() . self::PLUGIN_PATH . 'js/translations.php' );
6567 wp_register_script( 'admin', plugins_url() . self::PLUGIN_PATH . 'js/admin.js' );
6668 wp_register_script( 'search', plugins_url() . self::PLUGIN_PATH . 'js/search.js' );
6769 wp_register_script( 'suggestions', plugins_url() . self::PLUGIN_PATH . 'js/jquery.suggestions.js' );
@@ -71,6 +73,7 @@
7274 wp_enqueue_script( 'jquery-ui-dialog' );
7375
7476 // Enqueue our own scripts
 77+ wp_enqueue_script( 'translations' );
7578 wp_enqueue_script( 'admin' );
7679 wp_enqueue_script( 'search' );
7780 wp_enqueue_script( 'suggestions' );
Index: trunk/tools/wp-photocommons/search.php
@@ -1,4 +1,6 @@
22 <?php
 3+require_once '../../wp-load.php';
 4+
35 $path = dirname( $_SERVER['PHP_SELF'] );
46 // Standalone is used to debug/test this page directly,
57 // without having to the HEAD/BODY with it in admin.
@@ -16,7 +18,7 @@
1719 <body>
1820 <?php endif; ?>
1921
20 - <label for="wp-photocommons-search">Zoek:</label>
 22+ <label for="wp-photocommons-search"><?php _e("Search", "wp-photocommons"); ?>:</label>
2123 <input type="search" id="wp-photocommons-search" />
2224
2325 <ul id="wp-photocommons-results"></ul>
Index: trunk/tools/wp-photocommons/js/admin.js
@@ -1,9 +1,13 @@
22 (function($) {
33 var PATH = '../wp-content/plugins/wp-photocommons';
44
 5+ function _(msg) {
 6+ return window.PhotoCommons.translations[msg];
 7+ }
 8+
59 function addButtons() {
610 $('#media-buttons').append(''.concat(
7 - '<a id="photocommons-add" title="Afbeeldingen invoegen van Wikimedia Commons" style="padding-left:4px;">',
 11+ '<a id="photocommons-add" title="' + _("Insert images from Wikimedia Commons") + '" style="padding-left:4px;">',
812 '<img src="' + PATH + '/img/button.png"/>',
913 '</a>'
1014 ));
@@ -18,7 +22,7 @@
1923 var $self = $('#photocommons-dialog');
2024
2125 $self.dialog({
22 - title : 'PhotoCommons - Afbeelingen invoegen van Wikimedia Commons',
 26+ title : _('PhotoCommons') + ' - ' + _("Insert images from Wikimedia Commons"),
2327 width : 800,
2428 height : 500
2529 });
Index: trunk/tools/wp-photocommons/js/translations.php
@@ -0,0 +1,13 @@
 2+<?php
 3+ require_once "../../../../wp-load.php";
 4+?>
 5+// This is a Javascript file generated by PHP for the translations
 6+
 7+if ( !window.PhotoCommons ) {
 8+ window.PhotoCommons = {};
 9+}
 10+
 11+window.PhotoCommons.translations = {
 12+ "Insert images from Wikimedia Commons" : "<?php _e("Insert images from Wikimedia Commons", "wp-photocommons"); ?>",
 13+ "PhotoCommons" : "<?php _e("PhotoCommons", "wp-photocommons"); ?>"
 14+};
\ No newline at end of file
Property changes on: trunk/tools/wp-photocommons/js/translations.php
___________________________________________________________________
Added: svn:eol-style
115 + native

Comments

#Comment by Krinkle (talk | contribs)   00:51, 1 March 2011
+	const PLUGIN = "wp-photocommons";

Where is PLUGIN used ?

#Comment by Husky (talk | contribs)   09:38, 1 March 2011

Ah, nowhere :)

#Comment by Krinkle (talk | contribs)   16:18, 19 March 2011

Did you forget to commit an extra file ? Where are the translations stored ?

Status & tagging log