Commit 41945b32 authored by Dave Lane's avatar Dave Lane
Browse files

interim working internationalisation for WP WEnotes Posting and feed presentation

parent dcb016d7
......@@ -13,10 +13,8 @@ as a WordPress plugin. It adds shortcodes with similar arguments to the widgets:
The posting side of the plugin requires local copies (easily installed
as git submodules) of:
* [WEnotes](https://bitbucket.org/wikieducator/wenotes), the client-side
* [WEnotes](https://git.oeru.org/oeru/wenotes-aggregator), the client-side
Javascript
* [Sag](http://saggingcouch.com/), CouchDB libraries for PHP and Javascript
(the PHP one is used here)
## Note
......
......@@ -3,9 +3,9 @@
* Utility functions
*/
require WENOTES_PATH . '/includes/wenotes-admin.php';
require WENOTES_PATH . '/includes/wenotes-base.php';
class WEnotesUtil extends WEnotesAdmin {
class WEnotesUtil extends WEnotesBase {
// given a site object, return the site's name
public function get_site_tag($site) {
......
# Copyright (C) 2020 Jim Tittsler, Dave Lane
# Copyright (C) 2021 Jim Tittsler, Dave Lane
# This file is distributed under the same license as the WEnotes plugin.
msgid ""
msgstr ""
......@@ -9,10 +9,9 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2020-10-05T13:59:10+13:00\n"
"POT-Creation-Date: 2021-05-28T13:29:02+12:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.4.0\n"
"X-Domain: wenotes\n"
#. Plugin Name of the plugin
msgid "WEnotes"
......@@ -33,3 +32,62 @@ msgstr ""
#. Author URI of the plugin
msgid "https://oeru.org, http://WikiEducator.org/User:JimTittsler, http://WikiEducator.org/User:Davelane"
msgstr ""
#: wenotes-app.php:68
#: wenotes-site.php:18
msgid "WEnotes Details"
msgstr ""
#: wenotes-site.php:13
#: wenotes-test.php:13
msgid "Sorry, you are not allowed to edit this site."
msgstr ""
#: wenotes-site.php:20
msgid "<strong>WEnotes Details</strong> &mdash; This page shows a list of learners (with a current WordPress user account) associated with this Course, and those who have registered blog URLs which WEnotes periodically checks for suitably tagged posts to aggregate into the Course feed."
msgstr ""
#: wenotes-site.php:24
msgid "For more information:"
msgstr ""
#: wenotes-site.php:25
msgid "<a href=\"https://codex.wordpress.org/Network_Admin_Sites_Screen\">Documentation on Site Management</a>"
msgstr ""
#: wenotes-site.php:26
msgid "<a href=\"https://wordpress.org/support/forum/multisite/\">Support Forums</a>"
msgstr ""
#: wenotes-site.php:32
msgid "Invalid site ID."
msgstr ""
#: wenotes-site.php:37
msgid "The requested site does not exist."
msgstr ""
#: wenotes-site.php:41
msgid "Sorry, you are not allowed to access this page."
msgstr ""
#: wenotes-site.php:121
msgid "Site info updated."
msgstr ""
#. translators: %s: site name
#: wenotes-site.php:126
msgid "Edit Site: %s"
msgstr ""
#: wenotes-site.php:147
msgid "Visit"
msgstr ""
#: wenotes-site.php:147
msgid "Dashboard"
msgstr ""
#: wenotes-site.php:169
msgid "Site Address (URL)"
msgstr ""
Subproject commit cda30ac3c0be4ebbce20a9d25bb3510b799570ae
Subproject commit cc79d0d375df19e3107007cf9a1f3da7a2047f19
......@@ -2,10 +2,15 @@
require WENOTES_PATH . '/includes/wenotes-sites.php';
class WEnotes extends WEnotesSites {
class WEnotes extends WEnotesSites {
protected static $instance = NULL; // this instance
protected static $fresh = false; // true if freshly creating CouchDB...
protected static $settings = array(
'wenotes_source_name' => WENOTES_SOURCE_NAME,
'wenotes_source_url' => WENOTES_SOURCE_URL,
'wenotes_source' => 'wenotes_wp'
);
// returns an instance of this class if called, instantiating if necessary
public static function get_instance() {
......@@ -15,9 +20,12 @@ class WEnotes extends WEnotesSites {
// Do smart stuff when this object is instantiated.
public function init() {
//$this->log('in WEnotes init');
$this->log('in WEnotes init');
// add our updated links to the site nav links array via the filter
add_filter('network_edit_site_nav_links', array($this, 'insert_site_nav_link'));
if (WENOTES_SHOWTAB) {
add_filter('network_edit_site_nav_links', array($this, 'insert_site_nav_link'));
}
add_filter('admin_menu', array($this, 'add_admin_pages'));
// register all relevant shortcodes
$this->register_shortcodes();
// register all relevant hooks
......@@ -54,7 +62,6 @@ class WEnotes extends WEnotesSites {
$this->log('removing couchDB references for site '.$site_id);
}
// add our WEnotes Details per Site tab to the Site Edit Nav
public function insert_site_nav_link($links) {
$path = '../..'.parse_url(WENOTES_URL, PHP_URL_PATH).'wenotes-site.php';
......@@ -63,6 +70,21 @@ class WEnotes extends WEnotesSites {
return $links;
}
// add WEnotes admin page on a per-site basis
public function add_admin_pages() {
$this->log('in add_admin_pages');
add_menu_page(WENOTES_SLUG, WENOTES_MENU, 'manage_options',
WENOTES_ADMIN_SLUG, array($this, 'site_settings'));
}
// create the site settings page...
public function site_settings() {
// get the current site settings....
$site_id = get_current_blog_id();
$this->log('in site_settings with site '.$site_id);
echo "<p>This is some WEnotes content for site $site_id.</p>";
}
// show site_blog_urls for a given user
public function display_feeds_for_user($user) {
$sites = get_blogs_of_user($user->ID);
......@@ -267,7 +289,8 @@ class WEnotes extends WEnotesSites {
// submit a WEnotes post from the WordPress form.
// process WEnotesPost shortcode
public static function wenotespost( $atts ) {
public function wenotespost( $atts ) {
$this->log('in wenotespost! Atts ', print_r($atts, true));
$a = shortcode_atts( array(
'tag' => '',
'site' => '',
......@@ -276,7 +299,8 @@ class WEnotes extends WEnotesSites {
'path_id' => '',
'button' => 'Post a WEnote',
'leftmargin' => '53',
'anonymous' => 'You must be logged in to post to WEnotes.'
'anonymous' => 'You must be logged in to post to WEnotes.',
'language' => 'en_EN'
), $atts );
$current_user = wp_get_current_user();
if ( $current_user->ID == 0 ) {
......@@ -296,7 +320,7 @@ class WEnotes extends WEnotesSites {
<script type="text/javascript">/*<![CDATA[*/
$ = window.jQuery;
$(function() {
WEnotesPostWP("WEnotesPost1", '${a['tag']}', '${a['button']}', '${a['leftmargin']}');
WEnotesPostWP("WEnotesPost1", '${a['tag']}', '${a['button']}', '${a['leftmargin']}', '${a['language']}');
})/*]]>*/</script>
EOD;
}
......@@ -304,20 +328,26 @@ EOD;
}
// process WEnotes shortcode
public static function wenotes_func( $atts ) {
public function wenotes_func( $atts ) {
$this->log('in wenotes_func - atts = '.print_r($atts, true));
$a = shortcode_atts( array(
'tag' => '_',
'count' => 20,
'context' => 'tag'
'context' => 'tag',
'language' => 'en_EN'
), $atts );
$tag = strtolower( $a['tag'] );
$count = $a['count'];
$language = $a['language'];
$this->log('in wenotes_func language = '.$language);
$wenotesdiv = <<<EOD
<div class="WEnotes WEnotes-$count-$tag" data-tag="$tag" data-count="$count">
<div class="WEnotes WEnotes-$count-$tag-$language" data-tag="$tag" data-context="$context" data-count="$count" data-lang="$language">
<img class="WEnotesSpinner" src="//wikieducator.org/skins/common/images/ajax-loader.gif" alt="Loading..." style="margin-left: 53px;">
</div>
<script type="text/javascript">/*<![CDATA[*/
console.log('embedded JS...');
$ = window.jQuery;
window.wgUserName = null;
$(function() {
......
......@@ -61,6 +61,8 @@ if (!defined('LOG_STREAM')) {
// other useful parameters
// limit the amount of data we'll read in to check for feed data
define('WENOTES_MAX_FILE_READ_CHAR', 1000000);
define('WENOTES_SHOWTAB', true);
// include the dependencies
require WENOTES_PATH . '/wenotes-app.php';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment