(Original Author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * Translation Box * Element for rendering a translation box with tabs for the locales. Requires * $this->translationBox be set with defaultLocale, languages, table, and loaded. * * See app/views/developers/addon_edit_descriptions.thtml for sample usage * * Required parameters: * - $field - name of the field * - $translations - array in form of 'en-US' => 'Translation' * * Optional parameters: * - $id - the db id of the object if multiple will be on the same page * - $type - type of field - textbox or textarea (default) * - $width - width of the field, defaults to 600px * - $height - height of the field, defaults to 20 for textboxes and 100 for textareas * - $maxLength - maximum number of characters for a field * - $displayName - the name of the field for the header * - $description - description of the field * - $graybox - whether to display in a graybox */ if (!isset($graybox) || $graybox === true) { echo '
'; } echo (!empty($displayName) ? '

'.$html->image('developers/help.png', array('alt' => 'Help')).''.$displayName.'

' : ''); echo (!empty($description) ? "

{$description}

" : ''); ?>
translationBox['defaultLocale'], $translations)) { $translations[$this->translationBox['defaultLocale']] = ''; } foreach ($translations as $locale => $translation) { echo '
'; echo $locale.'
'; } ?>
image('developers/tab_add.png', array('onclick' => 'translation_box.addTab(this);', 'alt' => 'Add Translation', 'title' => 'Add Translation'))?>
> $translation) { $fieldName = "data[{$this->translationBox['table']}]".(!empty($id) ? "[{$id}]" : '')."[{$field}][{$locale}]"; if (empty($type) || $type == 'textarea') { echo ''; } elseif ($type == 'textbox') { echo ''; } if (!empty($maxLength)) { echo '
'.$html->image('developers/exclamation.png', array('alt' => '')).' Characters used:  '.strlen($translation).' / '.$maxLength.'
'; } } ?>
'; } ?> translationBox['loaded']): ?>
Select the locale of the translation to add:
Are you sure you wish to delete this translation?

What are these "translationBox['defaultLocale']?>" tabs?

This is a Translation Box. It allows you to localize a specific field into any other languages for which you might have a translation. You can add, edit, and remove translations using the locale tabs.

What if I don't have any translations?

If a user browses the site and a translation isn't available in their own language, it will fall back to your add-on's Default Locale, specified in the Edit Add-on Properties area. If you don't have any translations, just enter what you can into your Default Locale, which should be a language you speak.

translationBox['loaded'] = true; endif; ?>