Changeset 581
- Timestamp:
- 01/06/2011 03:23:20 AM (17 months ago)
- File:
-
- 1 edited
-
trunk/WordPress/plugin/transposh/core/parser.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WordPress/plugin/transposh/core/parser.php
r577 r581 507 507 if ($node->title) $this->parsetext($node->title); 508 508 509 // Meta content (keywords, description) are also good places to translate 510 if ($node->tag == 'meta' && $node->content )509 // Meta content (keywords, description) are also good places to translate (but not in robots...) 510 if ($node->tag == 'meta' && $node->content && ($node->name != 'robots')) 511 511 $this->parsetext($node->content); 512 512 … … 671 671 } 672 672 673 // this is used to reserve spans we cannot add directly (out of body, metas, etc) 674 $hiddenspans = ''; 675 $savedspan = ''; 676 673 677 // actually translate tags 674 678 // texts are first 675 679 foreach ($this->html->find('text') as $e) { 676 680 $replace = array(); 677 $savedspan = '';678 681 foreach ($e->nodes as $ep) { 679 682 list ($source, $translated_text) = call_user_func_array($this->fetch_translate_func, array($ep->phrase, $this->lang)); … … 685 688 } 686 689 if (($this->is_edit_mode || ($this->is_auto_translate && $translated_text == null))/* && $ep->inbody */) { 687 if ($ep->inselect || !$ep->inbody) {690 if ($ep->inselect) { 688 691 $savedspan .= $this->create_edit_span($ep->phrase, $translated_text, $source, true, $ep->srclang); 692 } elseif (!$ep->inbody) { 693 $hiddenspans .= $this->create_edit_span($ep->phrase, $translated_text, $source, true, $ep->srclang); 689 694 } else { 690 695 $translated_text = $this->create_edit_span($ep->phrase, $translated_text, $source, false, $ep->srclang); … … 765 770 } 766 771 767 // now we handle the meta content - which is simpler because they can't be edited or auto-translated 772 // now we handle the meta content - which is simpler because they can't be edited or auto-translated in place 768 773 // we also don't expect any father modifications here 774 // so we now add all those spans right before the <body> tag end 769 775 foreach ($this->html->find('[content]') as $e) { 770 776 $right = ''; … … 786 792 $e->content = $right; 787 793 } 794 if ($this->is_edit_mode) { 795 $hiddenspans .= $this->create_edit_span($ep->phrase, $translated_text, $source, true, $ep->srclang); 796 } 797 if (!$translated_text && $this->is_auto_translate && !$this->is_edit_mode) { 798 logger('untranslated meta for ' . $ep->phrase . ' ' . $this->lang); 799 if ($this->is_edit_mode || $this->is_auto_translate) { // FIX 800 } 801 } 788 802 } 789 803 } … … 792 806 logger("content-phrase: $newtext", 4); 793 807 } 808 } 809 810 if ($hiddenspans) { 811 $body = $this->html->find('body', 0); 812 if ($body != null) $body->lastChild()->outertext .= $hiddenspans; 794 813 } 795 814 // only in 5 out of 100 pages, with just translated pages, we might show an ad for transposh
Note: See TracChangeset
for help on using the changeset viewer.
