Skip to content

Commit

Permalink
Merge pull request #383 from GlotPress/release-2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ocean90 committed Apr 4, 2016
2 parents 422a33d + d3f9005 commit 26c9114
Show file tree
Hide file tree
Showing 176 changed files with 6,132 additions and 2,470 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# In the tests/data folder there are some data files that need to use unix line endings to ensure the tests pass correctly.
*.android.xml text eol=lf
*.resx.xml text eol=lf
*.properties text eol=lf
112 changes: 112 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Contribute

Hi there! Thank you so much for your interest in contributing to GlotPress. We'll try to make things as easy as possible for you in this guide. There are a number of ways to help out, and every one of them is appreaciated:

* Submitting patches: whether fixing a bug or adding new functionality
* Testing patches / PRs
* Running and writing tests

## Setting up

1. Clone this git repository on your development system. This is commonly inside your WordPress development site in the `wp-content/plugins/` directory.
2. Install [PHPUnit](https://phpunit.de/). We recommend using version 4.5, as that's the most current version that is compatible with all PHP versions we check against, and thus Travis is using that version.
3. Activate the plugin.
4. Visit `http://local.sitename/glotpress` to start using GlotPress. `local.sitename` is the domain where your development WordPress site runs, dependent on configuration.

## Submitting patches

Whether you want to fix a bug or implement a new feature, the process is pretty much the same:

0. [Search existing issues](https://github.com/GlotPress/GlotPress-WP/issues); if you can't find anything related to what you want to work on, [open a new issue](#helpful-tips-for-writing-issues).
1. [Fork](https://github.com/GlotPress/GlotPress-WP/fork) the repository.
2. Create a branch for each issue you'd like to address. Base your new branch on top of `develop` branch. Branches are named as such: `ISSUEID-keywords` for branches where an issue exists, or `keywords` for a branch without an issue yet. For example issue 216 for adding contributing.md would be `216-add-contributing-md`. Commit your changes.
3. Push the code changes from your local clone to your fork.
4. Open a pull request from your fork's feature branch to GlotPress's `develop` branch. Pull request name should mirror the branch's name. Take a look at [one such pull request](https://github.com/GlotPress/GlotPress-WP/pull/241) to get an idea of it. Pull request should have `Fixes #issue` / `Closes #issue`, or, if it's a partial solution, `Part of #issue` in the message to [enable automatic issue closing when a PR is merged](https://help.github.com/articles/closing-issues-via-commit-messages/).

We use the [Git workflow](https://github.com/GlotPress/GlotPress-WP/wiki/5.-Git-workflow). Please have a read through, as it will make everyone's life easier. Should you have questions about that, reach out to us on Slack (see below).

It doesn't matter if the code isn't perfect. The idea is to get it reviewed early and iterate on it.

Lastly, please follow the [WordPress Coding Standards](http://make.wordpress.org/core/handbook/coding-standards/).

## Testing patches / PRs

Testing of patches and PRs is a critical part of development. If you have contributed a PR or just want to help out, testing is a great place to start.

1. Check out the branch the PR was submitted on.
2. Leave feedback on the PR. Write up what you tested, what your results were and whether it solves the issue or not.

If you need help with checking out the branch, or the PR was submitted from someone's fork, GitHub provides help in checking out the correct branch. Navigate to the PR in question, and you should see a link to command line instructions. Follow those instructions.

![](https://cloud.githubusercontent.com/assets/617637/12953405/9df99808-d01a-11e5-88eb-958d23871f87.png)

## Running and writing tests

GlotPress includes automated test code, but coverage is not complete at this time. Contributing new tests for GlotPress is a great way to better understand the codebase and contribute to the project at the same time.

There are two types of automated tests:

* unit tests, implemented using [PHPUnit](http://phpunit.de/)
* general code metrics using [Scrutinizer](https://scrutinizer-ci.com/)

### Unit tests

You can run PHPUnit on Unix or Windows, however at this time instructions and scripts are only provided for Unix. The unit test files are in the `tests/` directory.

To run the unit tests on a Unix machine, open a command shell, change to your development directory for GlotPress and run:

```
./tests/bin/run-unittests.sh
```

To write unit tests, find the relevant file that has similar tests already in them (they are named accordingly), and add the tests there. If there isn't a file that has tests for the functionality you've written, create a new file, and name it `test_<functionality>.php`. PHPUnit will pick up the file automatically. Refer to the [PHPUnit documentation](https://phpunit.de/manual/4.5/en/index.html) and existing files for how to write new tests.

### Scrutinizer

For the most part feedback from Scrutinizer will flag up potential issues with the submitted code. It will tell you whether anything has been introduced or fixed. It will also give you explanations of those.

## Helpful tips for writing issues

When submitting an issue on GitHub there are several things you should include to ensure we can verify the problem and have enough information to resolve it.

### 1. What it is that's causing the bug?

As a general rule, include all the things that are needed for someone else to reproduce the issue locally. Things like "Importing originals doesn't work" are not enough for us to start on as it's missing a lot of necessary context.

Instead, for example if the translatable string is not picked up correctly, we'd need the following to reproduce the issue:

* the PHP source file of the translatable string
* the generated .pot file, and how you generated it from the php
* the actual result in GlotPress
* what you're expecting it to be, and how it differs from it

A good issue body in that case would be:

> Here's the part of my php file that's causing trouble:
>
> ```
> <?php
> $string = sprintf( __( 'Some translatable string with a %1$s', 'text-domain' ), 'placeholder' );
> ```
>
> I get the pot file by using the wp-i18n-grunt package (https://github.com/cedaro/grunt-wp-i18n) at release version 0.5.3. This is the pot file generated: (link to a gist for example).
>
> I expect the translatable string to be `Some translatable string with a %1$s`, but instead it's `Some translatable string with a`. Placeholder is missing.
(not an actual bug)

Look at some of the issues open currently to get an idea of it.

### 2. It helps to know what your environment is like

* Which PHP version are you using?
* What version of MySQL or other database software are you using?
* Which version of GlotPress do you have? (Which is the last commit? Find it with `git log -1`)
* What version of WordPress are you running?
* What are the plugins that are active on your site, and their versions?

These should be enough for us to move forward.

## Finally...

Thanks! Working on GlotPress should be fun! If you find any of this hard to figure out, let us know so we can improve our process or documentation! You can also find us in the [GlotPress channel on the WordPress Slack](https://wordpress.slack.com/messages/glotpress/). If you don't have access to it yet, [you can sign up for Slack access](https://make.wordpress.org/chat/).
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
/tests/build
/tests/build

# Composer
composer.lock
/vendor/
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "dev-lib"]
path = dev-lib
url = https://github.com/xwp/wp-dev-lib.git
branch = master
1 change: 1 addition & 0 deletions .jscsrc
1 change: 1 addition & 0 deletions .jshintignore
1 change: 1 addition & 0 deletions .jshintrc
3 changes: 1 addition & 2 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ filter:
excluded_paths: [tests/*]

tools:
external_code_coverage:
timeout: 10800
external_code_coverage: false

php_sim:
enabled: true
Expand Down
54 changes: 38 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,45 @@
language: php
sudo: false

notifications:
on_success: never
on_failure: change
language:
- php

php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0

env:
- WP_VERSION=latest WP_MULTISITE=0
## Cache composer bits
cache:
directories:
- vendor
- $HOME/.composer/cache

matrix:
include:
- php: 5.3
env: WP_VERSION=latest WP_MULTISITE=1
- php: 5.3
env: WP_VERSION=latest WP_MULTISITE=0
- php: 5.3
env: WP_VERSION=trunk WP_MULTISITE=0
- php: 5.4
env: WP_VERSION=latest WP_MULTISITE=0
- php: 5.5
env: WP_VERSION=latest WP_MULTISITE=0
- php: 5.6
env: WP_VERSION=trunk WP_MULTISITE=1
- php: 5.6
env: WP_VERSION=trunk WP_MULTISITE=0 WP_TRAVISCI=codecoverage
- php: 7.0
env: WP_VERSION=trunk WP_MULTISITE=0

install:
- export DEV_LIB_PATH=dev-lib
- if [ ! -e "$DEV_LIB_PATH" ] && [ -L .travis.yml ]; then export DEV_LIB_PATH=$( dirname $( readlink .travis.yml ) ); fi
- if [ ! -e "$DEV_LIB_PATH" ]; then git clone https://github.com/xwp/wp-dev-lib.git $DEV_LIB_PATH; fi
- source $DEV_LIB_PATH/travis.install.sh

script: ./tests/bin/run-travis-unittests.sh
script:
- source $DEV_LIB_PATH/travis.script.sh

after_script:
# Push coverage off to Codecov
- |
if [[ "$WP_TRAVISCI" == "codecoverage" ]] && [ -e "/tmp/wordpress/src/wp-content/plugins/GlotPress-WP/build/logs/clover.xml" ] ; then
bash <(curl -s https://codecov.io/bash) -f /tmp/wordpress/src/wp-content/plugins/GlotPress-WP/build/logs/clover.xml
fi
- |
source $DEV_LIB_PATH/travis.after_script.sh
86 changes: 83 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,91 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## 2.0.0 (April 04, 2016)

**Bugfixes**

* Delete cookies for notices on installs without a base. ([#379](https://github.com/GlotPress/GlotPress-WP/issues/379))
* Fix "Use as name" link on translation set creation page. ([#381](https://github.com/GlotPress/GlotPress-WP/issues/381))

## 2.0.0-rc.1 (March 29, 2016)

(this space intentionally left blank)

## 2.0.0-beta.2 (March 27, 2016)

**Security**

* Implement nonces for URLs and forms to help protect against several types of attacks including CSRF. ([#355](https://github.com/GlotPress/GlotPress-WP/issues/355))

**Bugfixes**

* Avoid a PHP warning when updating a glossary entry. ([#366](https://github.com/GlotPress/GlotPress-WP/issues/366))
* Improve mb_* compat functions to support all parameters and utilize WordPress' compat functions. ([#364](https://github.com/GlotPress/GlotPress-WP/issues/364))

## 2.0.0-beta.1 (March 17, 2016)

**Breaking Changes**

* Remove Translation Propagation from core. [Now available as a plugin](https://github.com/GlotPress/gp-translation-propagation/). ([#337](https://github.com/GlotPress/GlotPress-WP/issues/337))
* Remove user and option handling in `gp_update_meta()`/`gp_delete_meta()`. ([#300](https://github.com/GlotPress/GlotPress-WP/issues/300))
* Remove deprecated `assets/img/glotpress-logo.png`. ([#327](https://github.com/GlotPress/GlotPress-WP/issues/327))
* Remove `gp_sanitize_for_url()` in favor of `sanitize_title()` for enhanced slug generation. ([#330](https://github.com/GlotPress/GlotPress-WP/pull/330))
* Improve return values of `gp_meta_update()`. ([#318](https://github.com/GlotPress/GlotPress-WP/issues/318)).
* Remove CLI command `GP_CLI_WPorg2Slug`. ([#347](https://github.com/GlotPress/GlotPress-WP/issues/347))

**Features**

* Make projects, translation sets, and glossaries deletable via UI. ([#267](https://github.com/GlotPress/GlotPress-WP/issues/267))
* Update several locale definitions to use new Facebook and Google codes and correct country codes. ([#246](https://github.com/GlotPress/GlotPress-WP/issues/246))
* Add Greenlandic, Spanish (Guatemala), and Tahitian locale definition. ([#246](https://github.com/GlotPress/GlotPress-WP/issues/246))
* Add auto detection for format of uploaded import files. ([#290](https://github.com/GlotPress/GlotPress-WP/issues/290))
* Add UI to manage GlotPress administrators. ([#233](https://github.com/GlotPress/GlotPress-WP/issues/233))
* Add checkbox for case-sensitive translation searches. ([#312](https://github.com/GlotPress/GlotPress-WP/issues/312))
* Add support for Java properties files. ([#297](https://github.com/GlotPress/GlotPress-WP/issues/297))
* Add cancel link to import pages. ([#268](https://github.com/GlotPress/GlotPress-WP/issues/268))
* Add warning and disable the plugin if permalinks are not set. ([#218](https://github.com/GlotPress/GlotPress-WP/issues/218))
* Add warning and disable the plugin if unsupported version of PHP is detected. ([#276](https://github.com/GlotPress/GlotPress-WP/issues/276))
* Add inline documentation for actions and filters. ([#50](https://github.com/GlotPress/GlotPress-WP/issues/50))
* Add backend support to allow for integration with WordPress' user profiles. ([#196](https://github.com/GlotPress/GlotPress-WP/issues/196))
* Introduce a separate page for settings. ([#325](https://github.com/GlotPress/GlotPress-WP/issues/325))
* Validate slugs for translation sets on saving. ([#329](https://github.com/GlotPress/GlotPress-WP/issues/329))
* Standardize triggers in projects, translations and originals. ([#294](https://github.com/GlotPress/GlotPress-WP/issues/294))
* Introduce `GP_Thing::after_delete()` method and new actions. ([#294](https://github.com/GlotPress/GlotPress-WP/issues/294))
* Add .pot extension to `GP_Format_PO`. ([#230](https://github.com/GlotPress/GlotPress-WP/issues/230))
* Various code cleanups to improve code quality. ([#237](https://github.com/GlotPress/GlotPress-WP/issues/237))

**Bugfixes**

* Mark Sindhi locale definition as RTL. ([#243](https://github.com/GlotPress/GlotPress-WP/issues/243))
* Replace `current_user_can( 'manage_options' )` with GlotPress permissions. ([#254](https://github.com/GlotPress/GlotPress-WP/issues/254))
* Make child projects accessible if permalink structure has a trailing slash. ([#265](https://github.com/GlotPress/GlotPress-WP/issues/265))
* Use real URLs for back links instead of JavaScript's history `back()` method. ([#278](https://github.com/GlotPress/GlotPress-WP/issues/278))
* Replace deprecated/private `[_]wp_specialchars()` function with `htmlspecialchars()`. ([#280](https://github.com/GlotPress/GlotPress-WP/issues/280))
* Merge similar translation strings and avoid using HTML tags in translation strings. ([#295](https://github.com/GlotPress/GlotPress-WP/pull/295))
* Add missing `gp_` prefix for for translation actions. ([#232](https://github.com/GlotPress/GlotPress-WP/issues/232))
* Fix case where `$original->validate()` fails if singular is '0'. ([#301](https://github.com/GlotPress/GlotPress-WP/issues/301))
* Fix auto generation of project slugs with special characters. ([#328](https://github.com/GlotPress/GlotPress-WP/issues/328))
* Suspend cache invalidation during original imports. ([#332](https://github.com/GlotPress/GlotPress-WP/issues/332))
* Prevent submitting translations with empty plurals. ([#308](https://github.com/GlotPress/GlotPress-WP/pull/308))
* Update schema definitions to work with WordPress' `dbDelta()` function. ([#343](https://github.com/GlotPress/GlotPress-WP/issues/343))
* Fix redirect when a translation set update failed. ([#349](https://github.com/GlotPress/GlotPress-WP/pull/349))
* Prevent a PHP fatal error when importing originals. ([#302](https://github.com/GlotPress/GlotPress-WP/pull/302))

Thanks to all the contributors so far: Aki Björklund, Daisuke Takahashi, Dominik Schilling, Gabor Javorszky, Greg Ross, Peter Dave Hello, Rami, Sergey Biryukov

## 1.0.2 (March 09, 2016)

* Bugfix: Sanitize messages in `gp_notice()`.
**Security**

* Sanitize messages in `gp_notice()`.

## 1.0.1 (January 21, 2016)

* Bugfix: Unslash PHP's superglobals to prevent extra slashes in translations. ([#220](https://github.com/GlotPress/GlotPress-WP/issues/220))
* Bugfix: Adjust add/delete glossary entry links with trailing slashes. ([#224](https://github.com/GlotPress/GlotPress-WP/issues/224))
**Bugfixes**

* Unslash PHP's superglobals to prevent extra slashes in translations. ([#220](https://github.com/GlotPress/GlotPress-WP/issues/220))
* Adjust add/delete glossary entry links with trailing slashes. ([#224](https://github.com/GlotPress/GlotPress-WP/issues/224))

## 1.0.0 (January 18, 2016)

Expand Down
30 changes: 21 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,46 @@
# GlotPress

This is a community-backed plugin which brings [GlotPress](https://github.com/GlotPress/GlotPress) into WordPress as a plugin.
GlotPress is a WordPress plugin to let you set up your own collaborative, web-based software translation tool.

[![Build Status](https://travis-ci.org/GlotPress/GlotPress-WP.svg?branch=master)](https://travis-ci.org/GlotPress/GlotPress-WP) [![Code Coverage](https://scrutinizer-ci.com/g/GlotPress/GlotPress-WP/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/GlotPress/GlotPress-WP/?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/GlotPress/GlotPress-WP/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/GlotPress/GlotPress-WP/?branch=master)
[![Build Status](https://travis-ci.org/GlotPress/GlotPress-WP.svg?branch=develop)](https://travis-ci.org/GlotPress/GlotPress-WP) [![codecov.io](https://codecov.io/github/GlotPress/GlotPress-WP/coverage.svg?branch=develop)](https://codecov.io/github/GlotPress/GlotPress-WP?branch=develop) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/GlotPress/GlotPress-WP/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/GlotPress/GlotPress-WP/?branch=develop)

## Contributing

GlotPress as a WordPress plugin is still a work in progress, we're working through [the issues](https://github.com/GlotPress/GlotPress-WP/issues) to keep improving it in future releases.
Many open source projects span regions, countries and dialects and need to support a variety of translations, GlotPress is here to help you collaborate online with your translators to ensure your users see your software in their native language.

If you'd like to work on something and there's not currently an issue for it, open a new issue and describe your proposed change before jumping into coding.
GlotPress has two versions, a standalone version and this WordPress plugin version. At this time these two versions are functionally similar, but the plugin version is likely to start moving away from the standalone version in future versions. For the rest of this document, any reference to "GlotPress" should be taken as the plugin.

For more information about GlotPress, feel free to visit the channels listed below in the "Communication" section.

So who should use GlotPress?

Any developer of software that uses [gettext](http://www.gnu.org/software/gettext/), like WordPress theme or plugin authors. But that's just the start, anyone who uses a gettext bases system can use GlotPress to help their translators collaborate.

This plugin wouldn't be possible without all the hard work that has gone in to the standalone version of GlotPress and we'd like to thank all those who contribute to it.

## Installation

Search for "GlotPress" in the WordPress.org plugin directory and install it.

After activating the plugin, GlotPress can be accessed via `<home_url>/glotpress/`

# Manual Installation
```bash
$ cd /your/wordpress/folder/wp-content/plugins/
$ git clone git@github.com:GlotPress/GlotPress-WP.git glotpress
```

After activating the plugin, GlotPress can be accessed via `<home_url>/glotpress/`

To access GlotPress under a different path, modify the `GP_URL_BASE` constant in `wp-config.php`, for example to run it in /, you'd add
# More Info

```
define( 'GP_URL_BASE', '/' );
```
More information can be found on the [GlotPress Wiki](https://github.com/GlotPress/GlotPress-WP/wiki/6.-The-Manual).

## Communication

* [WordPress Slack](https://chat.wordpress.org/): #glotpress
* [GitHub Home](https://github.com/GlotPress/GlotPress-WP)
* [Blog](http://blog.glotpress.org/)
* [WordPress Slack](https://chat.wordpress.org/): #glotpress (for development only)

## Running Tests

Expand Down
Binary file removed assets/img/glotpress-logo.png
Binary file not shown.

0 comments on commit 26c9114

Please sign in to comment.