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

Localization ready & current ACF HTML for fields #126

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
3 changes: 3 additions & 0 deletions acf-qtranslate.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
define('ACF_QTRANSLATE_PLUGIN', __FILE__);
define('ACF_QTRANSLATE_PLUGIN_DIR', plugin_dir_path(ACF_QTRANSLATE_PLUGIN));

// set text domain
load_plugin_textdomain( 'acf-qtranslate', false, dirname( plugin_basename(__FILE__) ) . '/languages/' );

require_once ACF_QTRANSLATE_PLUGIN_DIR . 'src/plugin.php';
new acf_qtranslate_plugin;
Binary file added languages/acf-qtranslate-de_DE.mo
Binary file not shown.
93 changes: 93 additions & 0 deletions languages/acf-qtranslate-de_DE.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
msgid ""
msgstr ""
"Project-Id-Version: Advanced Custom Fields: qTranslate\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-26 12:06+0000\n"
"PO-Revision-Date: 2018-10-26 12:12+0000\n"
"Last-Translator: thomas <[email protected]>\n"
"Language-Team: Deutsch\n"
"Language: de_DE\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Loco https://localise.biz/"

#: src/plugin.php:246
msgid "Enable translation for Standard Field Types"
msgstr "Übersetzung für Standard-Feld-Typen"

#: src/plugin.php:254
msgid "Display language tabs"
msgstr "Sprachen-Tabs anzeigen"

#: src/plugin.php:262
msgid "Display the LSB on the following pages"
msgstr "Zeige die Sprach-Umschalter auf den folgenden Seiten"

#: src/plugin.php:275
msgid "ACF qTranslate Settings"
msgstr "ACF qTranslate Einstellungen"

#: src/plugin.php:293
msgid ""
"The following options represent additional functionality that is available "
"when using qTranslate-X. These functionality is off by default and must be "
"enabled below."
msgstr ""
"Die folgenden Optionen stellen zusätzliche Funktionen dar, die bei "
"Verwendung von qTranslate-X verfügbar sind. Diese Funktionalität ist "
"standardmäßig deaktiviert und muss unten aktiviert werden."

#: src/plugin.php:321
msgid "Enter each page on it's own line"
msgstr "Für jede Seite eine eigene Zeile eingeben"

#: src/acf_5/fields/file.php:50
msgid "File (qTranslate)"
msgstr "Datei (qTranslate)"

#: src/acf_5/fields/image.php:50
msgid "Image (qTranslate)"
msgstr "Bild (qTranslate)"

#: src/acf_5/fields/post_object.php:50
msgid "Post Object (qTranslate)"
msgstr "Beitrags-Objekt (qTranslate)"

#: src/acf_5/fields/text.php:50
msgid "Text (qTranslate)"
msgstr "Text (qTranslate)"

#: src/acf_5/fields/textarea.php:50
msgid "Text Area (qTranslate)"
msgstr "Text mehrzeilig (qTranslate)"

#: src/acf_5/fields/url.php:50
msgid "URL (qTranslate)"
msgstr "URL (qTranslate)"

#: src/acf_5/fields/wysiwyg.php:52
msgid "Wysiwyg Editor (qTranslate)"
msgstr "Wysiwyg Editor (qTranslate)"

#. Name of the plugin
msgid "Advanced Custom Fields: qTranslate"
msgstr ""

#. Description of the plugin
msgid ""
"Provides multilingual versions of the text, text area, and wysiwyg fields."
msgstr ""

#. URI of the plugin
msgid "http://github.com/funkjedi/acf-qtranslate"
msgstr ""

#. Author of the plugin
msgid "funkjedi"
msgstr ""

#. Author URI of the plugin
msgid "http://funkjedi.com"
msgstr ""
91 changes: 91 additions & 0 deletions languages/acf-qtranslate.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Advanced Custom Fields: qTranslate\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-26 12:06+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: \n"
"Language: \n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Loco https://localise.biz/"

#: src/plugin.php:246
msgid "Enable translation for Standard Field Types"
msgstr ""

#: src/plugin.php:254
msgid "Display language tabs"
msgstr ""

#: src/plugin.php:262
msgid "Display the LSB on the following pages"
msgstr ""

#: src/plugin.php:275
msgid "ACF qTranslate Settings"
msgstr ""

#: src/plugin.php:293
msgid ""
"The following options represent additional functionality that is available "
"when using qTranslate-X. These functionality is off by default and must be "
"enabled below."
msgstr ""

#: src/plugin.php:321
msgid "Enter each page on it's own line"
msgstr ""

#: src/acf_5/fields/file.php:50
msgid "File (qTranslate)"
msgstr ""

#: src/acf_5/fields/image.php:50
msgid "Image (qTranslate)"
msgstr ""

#: src/acf_5/fields/post_object.php:50
msgid "Post Object (qTranslate)"
msgstr ""

#: src/acf_5/fields/text.php:50
msgid "Text (qTranslate)"
msgstr ""

#: src/acf_5/fields/textarea.php:50
msgid "Text Area (qTranslate)"
msgstr ""

#: src/acf_5/fields/url.php:50
msgid "URL (qTranslate)"
msgstr ""

#: src/acf_5/fields/wysiwyg.php:52
msgid "Wysiwyg Editor (qTranslate)"
msgstr ""

#. Name of the plugin
msgid "Advanced Custom Fields: qTranslate"
msgstr ""

#. Description of the plugin
msgid ""
"Provides multilingual versions of the text, text area, and wysiwyg fields."
msgstr ""

#. URI of the plugin
msgid "http://github.com/funkjedi/acf-qtranslate"
msgstr ""

#. Author of the plugin
msgid "funkjedi"
msgstr ""

#. Author URI of the plugin
msgid "http://funkjedi.com"
msgstr ""
40 changes: 20 additions & 20 deletions src/acf_5/fields/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function initialize() {

// vars
$this->name = 'qtranslate_file';
$this->label = __("File (qTranslate)",'acf');
$this->label = __("File (qTranslate)", 'acf-qtranslate');
$this->category = __("qTranslate", 'acf');
$this->defaults = array(
'return_format' => 'array',
Expand Down Expand Up @@ -154,47 +154,47 @@ function render_field($field) {
}

?>
<div <?php acf_esc_attr_e($div); ?>>
<div class="acf-hidden">
<?php acf_hidden_input(array( 'name' => $field['name'], 'value' => $field['value'], 'data-name' => 'id' )); ?>
</div>
<div class="show-if-value file-wrap acf-soh">
<div <?php acf_esc_attr_e( $div ); ?>>
<?php acf_hidden_input(array( 'name' => $field['name'], 'value' => $field['value'], 'data-name' => 'id' )); ?>
<div class="show-if-value file-wrap">
<div class="file-icon">
<img data-name="icon" src="<?php echo $o['icon']; ?>" alt=""/>
<img data-name="icon" src="<?php echo esc_url($o['icon']); ?>" alt=""/>
</div>
<div class="file-info">
<p>
<strong data-name="title"><?php echo $o['title']; ?></strong>
<strong data-name="title"><?php echo esc_html($o['title']); ?></strong>
</p>
<p>
<strong><?php _e('File name', 'acf'); ?>:</strong>
<a data-name="filename" href="<?php echo $o['url']; ?>" target="_blank"><?php echo $o['filename']; ?></a>
<a data-name="filename" href="<?php echo esc_url($o['url']); ?>" target="_blank"><?php echo esc_html($o['filename']); ?></a>
</p>
<p>
<strong><?php _e('File size', 'acf'); ?>:</strong>
<span data-name="filesize"><?php echo $o['filesize']; ?></span>
<span data-name="filesize"><?php echo esc_html($o['filesize']); ?></span>
</p>

<ul class="acf-hl acf-soh-target">
<?php if( $uploader != 'basic' ): ?>
<li><a class="acf-icon -pencil dark" data-name="edit" href="#"></a></li>
<?php endif; ?>
<li><a class="acf-icon -cancel dark" data-name="remove" href="#"></a></li>
</ul>
</div>
<div class="acf-actions -hover">
<?php
if( $uploader != 'basic' ):
?><a class="acf-icon -pencil dark" data-name="edit" href="#" title="<?php _e('Edit', 'acf'); ?>"></a><?php
endif;
?><a class="acf-icon -cancel dark" data-name="remove" href="#" title="<?php _e('Remove', 'acf'); ?>"></a>
</div>
</div>
<div class="hide-if-value">
<?php if( $uploader == 'basic' ): ?>

<?php if( $field['value'] && !is_numeric($field['value']) ): ?>
<div class="acf-error-message"><p><?php echo $field['value']; ?></p></div>
<div class="acf-error-message"><p><?php echo acf_esc_html($field['value']); ?></p></div>
<?php endif; ?>

<input type="file" name="<?php echo $field['name']; ?>" id="<?php echo $field['id']; ?>" />
<label class="acf-basic-uploader">
<?php acf_file_input(array( 'name' => $field['name'], 'id' => $field['id'] )); ?>
</label>

<?php else: ?>

<p style="margin:0;"><?php _e('No file selected','acf'); ?> <a data-name="add" class="acf-button button" href="#"><?php _e('Add File','acf'); ?></a></p>
<p><?php _e('No file selected','acf'); ?> <a data-name="add" class="acf-button button" href="#"><?php _e('Add File','acf'); ?></a></p>

<?php endif; ?>

Expand Down
33 changes: 17 additions & 16 deletions src/acf_5/fields/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function initialize() {

// vars
$this->name = 'qtranslate_image';
$this->label = __("Image (qTranslate)",'acf');
$this->label = __("Image (qTranslate)", 'acf-qtranslate');
$this->category = __("qTranslate", 'acf');
$this->defaults = array(
'return_format' => 'array',
Expand Down Expand Up @@ -158,30 +158,31 @@ function render_field($field) {

?>
<div <?php acf_esc_attr_e( $div ); ?>>
<div class="acf-hidden">
<?php acf_hidden_input(array( 'name' => $field['name'], 'value' => $field['value'] )); ?>
<?php acf_hidden_input(array( 'name' => $field['name'], 'value' => $field['value'] )); ?>
<div class="show-if-value image-wrap" <?php if( $size['width'] ): ?>style="<?php echo esc_attr('max-width: '.$size['width'].'px'); ?>"<?php endif; ?>>
<img data-name="image" src="<?php echo esc_url($url); ?>" alt="<?php echo esc_attr($alt); ?>"/>
<div class="acf-actions -hover">
<?php
if( $uploader != 'basic' ):
?><a class="acf-icon -pencil dark" data-name="edit" href="#" title="<?php _e('Edit', 'acf'); ?>"></a><?php
endif;
?><a class="acf-icon -cancel dark" data-name="remove" href="#" title="<?php _e('Remove', 'acf'); ?>"></a>
</div>
</div>
<div class="view show-if-value acf-soh" <?php if( $size['width'] ) echo 'style="max-width: '.$size['width'].'px"'; ?>>
<img data-name="image" src="<?php echo $url; ?>" alt="<?php echo $alt; ?>"/>
<ul class="acf-hl acf-soh-target">
<?php if( $uploader != 'basic' ): ?>
<li><a class="acf-icon -pencil dark" data-name="edit" href="#" title="<?php _e('Edit', 'acf'); ?>"></a></li>
<?php endif; ?>
<li><a class="acf-icon -cancel dark" data-name="remove" href="#" title="<?php _e('Remove', 'acf'); ?>"></a></li>
</ul>
</div>
<div class="view hide-if-value">
<div class="hide-if-value">
<?php if( $uploader == 'basic' ): ?>

<?php if( $field['value'] && !is_numeric($field['value']) ): ?>
<div class="acf-error-message"><p><?php echo $field['value']; ?></p></div>
<div class="acf-error-message"><p><?php echo acf_esc_html($field['value']); ?></p></div>
<?php endif; ?>

<input type="file" name="<?php echo $field['name']; ?>" id="<?php echo $field['id']; ?>" />
<label class="acf-basic-uploader">
<?php acf_file_input(array( 'name' => $field['name'], 'id' => $field['id'] )); ?>
</label>

<?php else: ?>

<p style="margin:0;"><?php _e('No image selected','acf'); ?> <a data-name="add" class="acf-button button" href="#"><?php _e('Add Image','acf'); ?></a></p>
<p><?php _e('No image selected','acf'); ?> <a data-name="add" class="acf-button button" href="#"><?php _e('Add Image','acf'); ?></a></p>

<?php endif; ?>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/acf_5/fields/post_object.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function initialize() {

// vars
$this->name = 'qtranslate_post_object';
$this->label = __("Post Object (qTranslate)",'acf');
$this->label = __("Post Object (qTranslate)", 'acf-qtranslate');
$this->category = 'qTranslate';
$this->defaults = array(
'post_type' => array(),
Expand Down
2 changes: 1 addition & 1 deletion src/acf_5/fields/text.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function initialize() {

// vars
$this->name = 'qtranslate_text';
$this->label = __("Text (qTranslate)",'acf');
$this->label = __("Text (qTranslate)", 'acf-qtranslate');
$this->category = __("qTranslate",'acf');
$this->defaults = array(
'default_value' => '',
Expand Down
2 changes: 1 addition & 1 deletion src/acf_5/fields/textarea.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function initialize() {

// vars
$this->name = 'qtranslate_textarea';
$this->label = __("Text Area (qTranslate)",'acf');
$this->label = __("Text Area (qTranslate)", 'acf-qtranslate');
$this->category = __("qTranslate",'acf');
$this->defaults = array(
'default_value' => '',
Expand Down
2 changes: 1 addition & 1 deletion src/acf_5/fields/url.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function initialize() {

// vars
$this->name = 'qtranslate_url';
$this->label = __("Url (qTranslate)",'acf');
$this->label = __("URL (qTranslate)", 'acf-qtranslate');
$this->category = __("qTranslate",'acf');
$this->defaults = array(
'default_value' => '',
Expand Down
2 changes: 1 addition & 1 deletion src/acf_5/fields/wysiwyg.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function initialize() {

// vars
$this->name = 'qtranslate_wysiwyg';
$this->label = __("Wysiwyg Editor (qTranslate)",'acf');
$this->label = __("Wysiwyg Editor (qTranslate)", 'acf-qtranslate');
$this->category = __("qTranslate",'acf');
$this->defaults = array(
'tabs' => 'all',
Expand Down