Skip to content
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.

Commit

Permalink
adjust translation behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Fiebig committed Oct 7, 2016
1 parent 3be6be1 commit bdd0023
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion faf-compare.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php/*Plugin Name: FAF ComparePlugin URI: http://fafworx.deDescription: Show images before/after comparison of your WordPress images (based on TwentyTwenty).Version: 1.0Author: F.A. FiebigAuthor URI: http://fafworx.deLicense: GNU GENERAL PUBLIC LICENSE*/defined( 'ABSPATH' ) or die( 'No direct script access allowed!' );/** * add scripts and styles */function fafCompareEnqueueScriptsStyles(){ wp_enqueue_script('event-move-js', plugins_url('twentytwenty/js/jquery.event.move.js', __FILE__), array('jquery'), '1.0', true); wp_enqueue_script('twentytwenty-js', plugins_url('twentytwenty/js/jquery.twentytwenty.js', __FILE__), array('jquery'), '1.0', true); wp_enqueue_script('bc-co-js', plugins_url('twentytwenty/js/jquery.compare.js', __FILE__), array('jquery'), '1.0', true); wp_enqueue_style('foundation-css', plugins_url('twentytwenty/css/foundation.css', __FILE__)); wp_enqueue_style('twentytwenty-css', plugins_url('twentytwenty/css/twentytwenty.css', __FILE__), array('foundation-css'));}add_action('wp_enqueue_scripts', 'fafCompareEnqueueScriptsStyles');/** * add scripts and styles to admin */function fafCompareEnqueueAdminScriptsStyles(){ wp_enqueue_script('faf-compare-editor-js', plugins_url('editor/editor.js', __FILE__), array('jquery'), '1.0', true);}add_action('admin_enqueue_scripts', 'fafCompareEnqueueAdminScriptsStyles');/** * add editor button */function fafCompareAddEditorButton(){ echo '<a href="#" id="faf-compare-short" class="button">'.fafCompareTrans('FAF Compare').'</a>';}add_action('media_buttons', 'fafCompareAddEditorButton', 101);/** * add short code * * @param $atts * @return string */function fafCompareShort( $atts ){ if (isset($atts['before']) && isset($atts['after'])) { $orientation = (isset($atts['orientation'])) ? $atts['orientation'] : 'horizontal'; $size = (isset($atts['size'])) ? $atts['size'] : 'thumbnail'; $before = $atts['before']; $after = $atts['after']; $html = '<div class="twentytwenty-container" data-orientation="'.$orientation.'">'; $html .= wp_get_attachment_image($before, $size); $html .= wp_get_attachment_image($after, $size); $html .= '</div>'; return $html; }}add_shortcode('compare', 'fafCompareShort');/** * custom translation */function fafCompareTrans($string){ $locale = get_locale(); $lang = (!empty($locale)) ? $locale : WPLANG; $transFile = dirname(__FILE__).'/lang/'.$lang.'.php'; if (is_file($transFile)) { $translation = include($transFile); if (array_key_exists($string, $translation)) { return $translation[$string]; } } return $string;}
<?php/*Plugin Name: FAF ComparePlugin URI: http://fafworx.deDescription: Show images before/after comparison of your WordPress images (based on TwentyTwenty).Version: 1.0Author: F.A. FiebigAuthor URI: http://fafworx.deLicense: GNU GENERAL PUBLIC LICENSE*/defined( 'ABSPATH' ) or die( 'No direct script access allowed!' );function fafLoadTextdomain(){ load_plugin_textdomain('faf-compare', false, dirname(plugin_basename(__FILE__)) . '/lang/');}add_action('plugins_loaded', 'fafLoadTextdomain');/** * add scripts and styles */function fafCompareEnqueueScriptsStyles(){ wp_enqueue_script('event-move-js', plugins_url('twentytwenty/js/jquery.event.move.js', __FILE__), array('jquery'), '1.0', true); wp_enqueue_script('twentytwenty-js', plugins_url('twentytwenty/js/jquery.twentytwenty.js', __FILE__), array('jquery'), '1.0', true); wp_enqueue_script('bc-co-js', plugins_url('twentytwenty/js/jquery.compare.js', __FILE__), array('jquery'), '1.0', true); wp_enqueue_style('foundation-css', plugins_url('twentytwenty/css/foundation.css', __FILE__)); wp_enqueue_style('twentytwenty-css', plugins_url('twentytwenty/css/twentytwenty.css', __FILE__), array('foundation-css'));}add_action('wp_enqueue_scripts', 'fafCompareEnqueueScriptsStyles');/** * add scripts and styles to admin */function fafCompareEnqueueAdminScriptsStyles(){ wp_enqueue_script('faf-compare-editor-js', plugins_url('editor/editor.js', __FILE__), array('jquery'), '1.0', true);}add_action('admin_enqueue_scripts', 'fafCompareEnqueueAdminScriptsStyles');/** * add editor button */function fafCompareAddEditorButton(){ echo '<a href="#" id="faf-compare-short" class="button">'.__('FAF Image Compare', 'faf-compare').'</a>';}add_action('media_buttons', 'fafCompareAddEditorButton', 101);/** * add short code * * @param $atts * @return string */function fafCompareShort( $atts ){ if (isset($atts['before']) && isset($atts['after'])) { $orientation = (isset($atts['orientation'])) ? $atts['orientation'] : 'horizontal'; $size = (isset($atts['size'])) ? $atts['size'] : 'thumbnail'; $before = $atts['before']; $after = $atts['after']; $html = '<div class="twentytwenty-container" data-orientation="'.$orientation.'">'; $html .= wp_get_attachment_image($before, $size); $html .= wp_get_attachment_image($after, $size); $html .= '</div>'; return $html; }}add_shortcode('compare', 'fafCompareShort');
Expand Down
1 change: 0 additions & 1 deletion lang/de_DE.php

This file was deleted.

1 change: 0 additions & 1 deletion lang/en_US.php

This file was deleted.

3 changes: 3 additions & 0 deletions lang/faf-compare-de_DE.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

msgid "FAF Image Compare"
msgstr "FAF Bildervergleich"
3 changes: 3 additions & 0 deletions lang/faf-compare-en_GB.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

msgid "FAF Image Compare"
msgstr "FAF Image Compare"

0 comments on commit bdd0023

Please sign in to comment.