-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# gp-use-slug-for-downloads | ||
A plugin for GlotPress as a WordPress plugin that uses the translation set slug for the name of the download file name. | ||
# GlotPress Remove Projects from Breadcrumbs | ||
A plugin for [GlotPress as a WordPress plugin](https://github.com/deliciousbrains/GlotPress) that uses the translation set slug for the name of the download file name. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
=== GP Use Slug for Downloads === | ||
Contributors: gregross | ||
Donate link: http://toolstack.com/donate | ||
Plugin URI: http://glot-o-matic.com/gp-use-slug-for-downloads | ||
Author URI: http://toolstack.com | ||
Tags: translation, glotpress | ||
Requires at least: 4.4 | ||
Tested up to: 4.4 | ||
Stable tag: 0.5 | ||
License: GPLv2 | ||
License URI: http://www.gnu.org/licenses/gpl-2.0.html | ||
|
||
A plugin for [GlotPress as a WordPress plugin](https://github.com/deliciousbrains/GlotPress) that uses the translation set slug for the name of the download file name. | ||
|
||
== Description == | ||
|
||
A plugin for [GlotPress as a WordPress plugin](https://github.com/deliciousbrains/GlotPress) that uses the translation set slug for the name of the download file name. | ||
|
||
== Installation == | ||
|
||
Install from the WordPress plugin directory. | ||
|
||
== Frequently Asked Questions == | ||
|
||
= TBD = | ||
|
||
TBD | ||
|
||
== Changelog == | ||
|
||
= 1.0 = | ||
* Release Date: TBD | ||
* Initial release. | ||
|
||
== Upgrade Notice == | ||
|
||
= 1.0 = | ||
|
||
Initial release, no upgrade notes at this time. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/* | ||
Plugin Name: GlotPress Use Slug for Downloads | ||
Plugin URI: http://glot-o-matic.com/gp-use-slug-for-downloads | ||
Description: Use the translation set slug for the name of the download file name. | ||
Version: 0.5 | ||
Author: gregross | ||
Author URI: http://toolstack.com | ||
Tags: glotpress, glotpress plugin | ||
License: GPLv2 | ||
License URI: http://www.gnu.org/licenses/gpl-2.0.html | ||
*/ | ||
|
||
class GP_Use_Slug_for_Downloads { | ||
public $id = 'use-slug-for-downloads'; | ||
|
||
public function __construct() { | ||
|
||
add_action( 'gp_export_translations_filename', array( $this, 'gp_export_translations_filename' ), 10, 5 ); | ||
} | ||
|
||
public function gp_export_translations_filename( $filename, $format, $locale, $project, $translation_set ) { | ||
|
||
if( $translation_set->slug != '' && $translation_set->slug != 'default' ) { | ||
$filename = $translation_set->slug . '.' . $format->extension; | ||
} | ||
|
||
return $filename; | ||
} | ||
|
||
} | ||
|
||
// Add an action to WordPress's init hook to setup the plugin. Don't just setup the plugin here as the GlotPress plugin may not have loaded yet. | ||
add_action( 'gp_init', 'gp_use_slug_for_downloads_init' ); | ||
|
||
// This function creates the plugin. | ||
function gp_use_slug_for_downloads_init() { | ||
GLOBAL $gp_use_slug_for_downloads; | ||
|
||
$gp_use_slug_for_downloads = new GP_Use_Slug_for_Downloads; | ||
} |