Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Release Alpha 1 - part 2

Complete moves from Translation to Babble.

Updates to readme.txt and babble-poc.php as per previous commit
comments.
  • Loading branch information...
commit b675d04307491d74aa35acd114305da801def399 1 parent f7cee68
Simon Wheatley authored
Showing with 65 additions and 10 deletions.
  1. +0 −4 README
  2. +21 −6 translation-poc.php → babble-poc.php
  3. +44 −0 readme.txt
View
4 README
@@ -1,4 +0,0 @@
-This is an initial proof of concept plugin to assess how
-best to approach a modern WP translation/multi-language
-plugin. We hope to develop it further, but, for the moment,
-within the scope of requirements for our FSD project.
View
27 translation-poc.php → babble-poc.php
@@ -1,12 +1,12 @@
<?php
/*
-Plugin Name: Translations Proof of Concept
-Plugin URI: http://simonwheatley.co.uk/wordpress/tpoc
+Plugin Name: Babble – Proof of Concept
+Plugin URI: https://github.com/simonwheatley/babble
Description: Translation proof of concept
-Version: 0.1
+Version: alpha 1
Author: Simon Wheatley
-Author URI: http://simonwheatley.co.uk//wordpress/
+Author URI: http://simonwheatley.co.uk/wordpress/
*/
/* Copyright 2011 Simon Wheatley
@@ -39,6 +39,7 @@
* Hooks the WP init action early
*
* @return void
+ * @access private
**/
function sil_init_early() {
global $sil_post_types;
@@ -68,6 +69,7 @@ function sil_init_early() {
*
* @param array $langs The language codes
* @return array An array of language codes utilised for this site.
+ * @access private
**/
function sil_rewrite_rules_filter( $rules ){
// Add a prefix to the URL to pick up the virtual sub-dir specifying
@@ -84,6 +86,7 @@ function sil_rewrite_rules_filter( $rules ){
*
* @param string $locale The locale
* @return string The locale
+ * @access private
**/
function sil_locale( $locale ) {
// @FIXME: Copying a huge hunk of code from WP->parse_request here, feels ugly.
@@ -154,6 +157,7 @@ function sil_locale( $locale ) {
*
* @param array $langs The language codes
* @return array An array of language codes utilised for this site.
+ * @access private
**/
function sil_languages( $langs ) {
$langs[] = 'de_DE';
@@ -170,6 +174,7 @@ function sil_languages( $langs ) {
* @param string $post_type The post type which has just been registered.
* @param array $args The arguments with which the post type was registered
* @return void
+ * @access private
**/
function sil_registered_post_type( $post_type, $args ) {
// @FIXME: When we turn this into classes we can avoid a global $sil_syncing here
@@ -261,6 +266,7 @@ function sil_registered_post_type( $post_type, $args ) {
* @param string $taxonomy The name of the newly registered taxonomy
* @param array $args The args passed to register the taxonomy
* @return void
+ * @access private
**/
function sil_registered_taxonomy( $taxonomy, $object_type, $args ) {
// @FIXME: When we turn this into classes we can avoid a global $sil_syncing here
@@ -321,6 +327,7 @@ function sil_registered_taxonomy( $taxonomy, $object_type, $args ) {
*
* @param object $wp WP object, passed by reference (so no need to return)
* @return void
+ * @access private
**/
function sil_parse_request( $wp ) {
// If this is the site root, redirect to default language homepage
@@ -399,7 +406,7 @@ function sil_parse_request( $wp ) {
*
* @param array $query_vars An array of the public query vars
* @return array An array of the public query vars
- * @author Simon Wheatley
+ * @access private
**/
function sil_query_vars( $query_vars ) {
// @FIXME: We only add the home_url filter at this point because having it earlier screws with the request method of the WP class.
@@ -416,6 +423,7 @@ function sil_query_vars( $query_vars ) {
*
* @param array $posts The posts retrieved by WP_Query, passed by reference
* @return array The posts
+ * @access private
**/
function sil_the_posts( $posts ) {
$subs_index = array();
@@ -446,6 +454,7 @@ function sil_the_posts( $posts ) {
*
* @param object $wp_admin_bar The WP Admin Bar, passed by reference
* @return void
+ * @access private
**/
function sil_admin_bar_menu( $wp_admin_bar ) {
global $wp, $sil_post_types, $sil_lang_map;
@@ -531,6 +540,7 @@ function sil_admin_bar_menu( $wp_admin_bar ) {
* @param string $orig_scheme The original scheme
* @param int $blog_id The ID of the blog
* @return string The URL
+ * @access private
**/
function sil_home_url( $url, $path ) {
$orig_url = $url;
@@ -548,6 +558,7 @@ function sil_home_url( $url, $path ) {
* Hooks the WP admin_init action
*
* @return void
+ * @access private
**/
function sil_admin_init( ) {
add_filter( 'home_url', 'sil_home_url', null, 2 );
@@ -559,6 +570,7 @@ function sil_admin_init( ) {
*
* @param string $admin_url The admin URL
* @return string The URL with the appropriate language (lang) GET parameter
+ * @access private
**/
function sil_admin_url( $url ) {
return add_query_arg( array( 'lang' => sil_get_current_lang_code() ), $url );
@@ -570,6 +582,7 @@ function sil_admin_url( $url ) {
*
* @param array $menu The WP Admin Menu
* @return array The WP Admin Menu, with our query args
+ * @access private
**/
function sil_add_menu_classes( $menu ) {
// @FIXME: Adding the language string like this feels so so dirty.
@@ -586,6 +599,7 @@ function sil_add_menu_classes( $menu ) {
* @param string $post_link The permalink
* @param object $post The WP Post object being linked to
* @return string The permalink
+ * @access private
**/
function sil_post_type_link( $post_link, $post, $leavename ) {
global $sil_post_types, $sil_lang_map, $wp_rewrite;
@@ -693,6 +707,7 @@ function sil_post_type_link( $post_link, $post, $leavename ) {
* @param string $link The permalink for the page
* @param int $id The ID for the post represented by this permalink
* @return string
+ * @access private
**/
function sil_page_link( $link, $id ) {
global $sil_syncing;
@@ -719,7 +734,6 @@ function sil_page_link( $link, $id ) {
* @param int|object $post The WP Post object, or the ID of a post
* @return string The transid
* @access private
- * @author Simon Wheatley
**/
function sil_get_transid( $post ) {
$post = get_post( $post );
@@ -736,6 +750,7 @@ function sil_get_transid( $post ) {
* @param int $post_id The ID of the post which has just been inserted
* @param object $post The WP Post object which has just been inserted
* @return void
+ * @access private
**/
function sil_wp_insert_post( $post_id, $post ) {
global $sil_syncing;
View
44 readme.txt
@@ -0,0 +1,44 @@
+=== Babble ===
+Contributors: simonwheatley
+Requires at least: 3.3-aortic-dissection
+Tested up to: 3.3-aortic-dissection
+Stable tag: Alpha 1
+Tags: translations
+
+A plugin to handle translating content into a variety of languages.
+
+== Description ==
+
+This plugin is at a proof of concept stage for translating post type content for the built
+in types of `post` and `page`.
+
+The plugin is built with the Automattic VIP Hosting Environment in mind, and, hopefully, to
+WordPress development best practices.
+
+There are a **lot** of `@FIXME` comments, expressing doubts, fears, uncertainties and
+unknowns; feel free to weigh in on any of them.
+
+Please send bugs to simon@sweetinteraction.com, or enter them on https://github.com/simonwheatley/babble/issues
+
+== Installation ==
+
+Installation is a little more involved than usual.
+
+1. Upload the `babble` directory to the `/wp-content/plugins/` directory
+1. Activate the plugin through the 'Plugins' menu in WordPress
+1. Apply the `new_hook.diff` to add the `registered_post_type` hook to before `return $args;` in the `register_post_type` function in the `wp-includes/post.php` file.
+1. Apply the `new_tax_hook.diff` to add the `registered_taxonomy` hook to the end of the `register_taxonomy` function in the `wp-includes/taxonomy.php` file.
+1. Copy the contents of `languages` into `wp-content/languages/` (optional, but makes it easier to see when languages have been switched)
+
+== Screenshots ==
+
+1. Shows the Babble language switch menu in the admin area, showing the site in Hebrew and the options to switch to English or German
+2. Shows the Babble language switch menu while editing a post, where a German translation has been created and offering the option to create a Hebrew translation
+3. Shows the provisional URL structure on the frontend, and the collapsed Babble language switcher menu in the admin bar
+
+== Changelog ==
+
+= alpha 1 =
+
+Proof of concept concentrating on the translation of posts. Taxonomies and menus are not handled yet. Widgets are out of scope completely for this phase of work.
+
Please sign in to comment.
Something went wrong with that request. Please try again.