37
GlotPress aka translate.WordPress.org WordCamp Praha 2015

GlotPress aka translate.wordpress.org

Embed Size (px)

Citation preview

GlotPress aka translate.WordPress.org WordCamp Praha 2015

Marko Heijnen

• Lead developer of GlotPress

• Core contributor for WordPress

• Working for 1&1 as their WordPress specialist

To start with, what is

GlotPress

• GlotPress is a collaborative, web-based software translation tool

• GlotPress will let you, or an entire team, to translate their favourite software

• It is as open-source like WordPress is

Features

• Different roles: Translators, Validators and Admins

• Translate strings

• Validate strings

• Manage strings by reject/approve them

• Having a glossary with common words

• Import/Export different formats

Default theme

Custom theme

Translations overview

Translations flow

The history behind it

The history

• Started in April 2008 by Nikolay Bachiyski.

• Uses BackPress as a framework.

• And it’s OOP developed.

• March 2013 I started managing GlotPress.

• In 2014 we had our first GSoC project.

How it is structured

OOP

• Uses BackPress which has a lot of useful classes (and functions).

• And we build on top of that our features like routers, formats and things.

• Those three type of objects always need to extend the generic class.

• The generic classes have shared functionality or abstract methods the derived class needs.

GP_Thing

• Because of the generic classes we can make our code more readable.

• You can define in a thing which fields are required to create a new item.

• A thing is a project, user, translations etc.

• GP_Glossary file has only 42 lines of code and has all validations in place.

The use of functions

• We still use them a lot like WordPress does for in themes.

• A lot of them are copied over from WordPress.

• This is a great thing cause if you are using GlotPress yourself you can “easily” add a feature to GlotPress because the hook system is in place.

• And so many other great features you use when building for WordPress

CLI

• GlotPress has a lot of scripts that you can or must use.

• Like adding a new admin is a must due missing user management. Will have an add user script soon.

• Or things like import/export originals or translations.

• It creates possibilities to build automatic tasks

WordPress core & translate.WordPress.org

translate.WordPress.org instalation

Current Statusdownloadable packages

• 141 locales with a wp_locale

• 41 locales are up to date

• 15 locales are still on 4.1

• 8 locales are one major version behind

• 16 locales are behind by two or more major version

• 61 locales don’t have a package

• 40 locales have a language pack

• Oldest version is 2.8.5.

For Czech

For future

• More integrated in the WordPress environment

• Soon it will include all plugins and themes

• Currently ~10.000 plugins are translatable

Some of the new features

Glossary

Profiles

Upcoming features

• Decline with feedback

• User dashboard

• Notifications

• Improved workflow

• New themehttps://github.com/GlotPress/New-Default-Theme

What can you do with it as a developer?

Use it yourself

• Using it for your own themes, plugins or projects

• Almost as easy to extend as WordPress

• It has a grunt plugin to download translations easily

Grunt

THE JAVASCRIPT TASK RUNNER http://gruntjs.com

• Running tasks by using CLI

• Easy to use, harder to configure

• Extendable with your own plugins

• Uses npm for plugin management

The GlotPress grunt task

grunt.initConfig({ glotpress_download: { core: { options: { domainPath: 'languages', url: 'http://wp-translate.org', slug: 'tabify-edit-screen', textdomain: 'tabify-edit-screen', } }, },});

GP_Plugin

• Has a set of useful methods based on your defined id.

• get_option, update_option

• add_action, add_filter

• remove_action, remove_filter

The base of your plugin

<?php

class My_First_Plugin extends GP_Plugin {

public $id = 'my-first-plugin';

public function __construct() {

}

}

GP::$plugins->my_first_plugin = new My_First_Plugin;

Plugins out there

• https://github.com/Yoast/glotpress-seo

• https://github.com/Yoast/i18n-module

• https://github.com/markoheijnen/GlotPress-APCu-Cache

• https://github.com/markoheijnen/GlotPress-Analytics

• https://github.com/markoheijnen/GlotPress-child-theme

• Private project: GlotPress Updater

WP-Translate.org

Updater

The tools we use

Tools we use

• We do have a certain amount of Unit tests Travis to run our unit tests

• https://scrutinizer-ci.com/g/GlotPress/GlotPress/ for Code quality scans

• https://coveralls.io/ for code coverage history and stats

Thank you for listening

Questions?

@markoheijnenmarkoheijnen.com