Skip to content

Commit

Permalink
Make more copy translatable, fix 'No field is unique' setting
Browse files Browse the repository at this point in the history
  • Loading branch information
brendo committed Jun 8, 2012
1 parent 86392e7 commit 0fe3c6b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
32 changes: 21 additions & 11 deletions content/content.importers.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,15 @@ public function __viewRun() {
__('Run XML Importer')
)
));
$this->appendSubheading(__('Run XML Importer'));

$button = Widget::Anchor(
__('Edit XML Importer'),
$this->_uri . '/importers/edit/' . $this->_context[1] . '/',
__('Edit XML Importer'),
'button'
);

$this->appendSubheading(__('Run XML Importer'), $button);

foreach ($this->_runs as $run) {
$importer = $run['importer'];
Expand All @@ -111,7 +119,7 @@ public function __viewRun() {
// Markup invalid:
if ($status == XMLImporter::__ERROR_PREPARING__) {
$fieldset->appendChild(new XMLElement(
'h3', 'Import Failed'
'h3', __('Import Failed')
));

$list = new XMLElement('ol');
Expand All @@ -126,7 +134,7 @@ public function __viewRun() {
// Invalid entry:
else if ($status == XMLImporter::__ERROR_VALIDATING__) {
$fieldset->appendChild(new XMLElement(
'h3', 'Import Failed'
'h3', __('Import Failed')
));

// Gather statistics:
Expand Down Expand Up @@ -188,7 +196,7 @@ public function __viewRun() {
// Passed:
else {
$fieldset->appendChild(new XMLElement(
'h3', 'Import Complete'
'h3', __('Import Complete')
));

$importer_result = array(
Expand Down Expand Up @@ -264,7 +272,7 @@ public function __actionEditNormal() {
$this->_errors['source'] = __('Source must not be empty.');
}

else if (!filter_var($fields['source'], FILTER_VALIDATE_URL)) {
else if(!filter_var($fields['source'], FILTER_VALIDATE_URL)) {
$this->_errors['source'] = __('Source is not a valid URL.');
}

Expand Down Expand Up @@ -734,13 +742,14 @@ public function __viewEdit() {
$group = new XMLElement('div');
$group->setAttribute('class', 'two columns');

$label = Widget::Label('XPath Expression');
$label = Widget::Label(__('XPath Expression'));
$label->setAttribute('class', 'column');
$input = Widget::Input("{$field_name}[xpath]");
$label->appendChild($input);
$group->appendChild($label);

$label = Widget::Label('PHP Function <i>Optional</i>');
$label = Widget::Label(__('PHP Function'));
$label->appendChild(new XMLElement('i', __('Optional')));
$label->setAttribute('class', 'column');
$input = Widget::Input("{$field_name}[php]");
$label->appendChild($input);
Expand All @@ -752,7 +761,7 @@ public function __viewEdit() {
$label->setAttribute('class', 'meta');
$input = Widget::Input("fields[unique-field]", $field_id, 'radio');

$label->setValue($input->generate(false) . ' Is unique');
$label->setValue($input->generate(false) . ' ' . __('Is unique'));
$li->appendChild($label);
$section_fields->appendChild($li);
}
Expand Down Expand Up @@ -802,7 +811,8 @@ public function __viewEdit() {

$group->appendChild($label);

$label = Widget::Label(__('PHP Function <i>Optional</i>'));
$label = Widget::Label(__('PHP Function'));
$label->appendChild(new XMLElement('i', __('Optional')));
$label->setAttribute('class', 'column');
$input = Widget::Input(
"{$field_name}[php]",
Expand All @@ -825,7 +835,7 @@ public function __viewEdit() {
$input->setAttribute('checked', 'checked');
}

$label->setValue($input->generate(false) . ' Is unique');
$label->setValue($input->generate(false) . ' ' . __('Is unique'));
$li->appendChild($label);
$section_fields->appendChild($li);
}
Expand All @@ -835,7 +845,7 @@ public function __viewEdit() {

$label = Widget::Label();
$label->setAttribute('class', 'meta');
$input = Widget::Input("fields[unique-field]", $field_id, 'radio');
$input = Widget::Input("fields[unique-field]", '0', 'radio');

if (isset($this->_fields['unique-field']) && !$this->_fields['unique-field']) {
$input->setAttribute('checked', 'checked');
Expand Down
1 change: 1 addition & 0 deletions lib/class.xmlimporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function handleXMLError($errno, $errstr, $errfile, $errline, $context) {

$self = $this; // Fucking PHP...
$options = $this->options();
$passed = true;

if ($remote) {
if (!is_null($source)) {
Expand Down
1 change: 0 additions & 1 deletion templates/xml-importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ public function allowEditorToParse() {
}
}

?>

0 comments on commit 0fe3c6b

Please sign in to comment.