Since scripts are not allowed on WordPress(.com) blogs, I was wondering whether there is a way to get the following Google Translate code to work on a WordPress (.com) blog via the Text widget? Thanks in advance.
<div id="google_translate_element"></div><script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en'
}, 'google_translate_element');
}
</script><script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
You can't run most JS on wordpress.com, but there seems to be a workaround to use Google Translate: http://en.forums.wordpress.com/topic/translation-widget?replies=20
You're making it too complicated -- you can just use html. Color coded explanation with a little story here:
http://conradcook.wordpress.com/2012/07/21/machine-translation-fail/
Related
The Meteor official tutorial does not refer template name, instead uses "body". If you replace "body" by template name it does not work, but it should work by theory.
Template.body.helpers //this works, but why?
Template.task.helpers //this does not work, why?
There seems to be no explanation for this in the tutorial.
What am I missing?
What you missed is that template for <body></body> is created by default. Inside of body template you've got your each loop, which is managed by Template.body.helpers.
Template.task.helpers can only manage what is used directly inside of <template name="task"></template>.
I am trying to create a blog in wordpress. Since I might need to add some code blocks to my posts, I was wondering if there is any CSS style to represent code block.
A very simple example would be stackoverflow code tag (shown below)
<script type="text/javascript">
alert('this is example of what i need to do ') ;
</script>
Since you are using wordpress, there are plugins to do that. Just by looking at http://wordpress.org/extend/plugins/tags/syntax-highlighting there seems to be quite a few to choose from.
I have a website in ASP.NET which will be used globally. There is a requirement to provide a language translation option at the home page where the user will be able to select a language and the page(s) will be rendered in that. I have heard of Google translation service but have no idea how to use them. Can anyone provide some links/suggestion that can guide me in this?
Regards.
Follow the instructions here and you'll be good to go, but essentially, all you need to do is include this code:
<div id="google_translate_element"></div><script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en'
}, 'google_translate_element');
}
</script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
Into every page that you want to allow the user to be able to translate.
I recently switched my blog from joomla to wordpress and i'm having problems when posting code snippets.
The editor seems to remove some of the characters when i save my posts.
I am using a plugin that i got from this link: http://alexgorbatchev.com/SyntaxHighlighter/
Example:
<pre class="brush: javascript">;
var window.onload = function() {
alert("Loading is complete");
};
</pre>
Is formatted to:
<pre>;
var window.onload = function() {
alert("Loading is complete");
};
</pre>
How can i solve this problem?
If you're on WordPress.com, I believe you should be using a shortcode like so: http://en.support.wordpress.com/code/posting-source-code/
If you're on self-hosted WordPress and using the WordPress plugin Syntax Highlighter (http://wordpress.org/extend/plugins/syntax-highlighter/), again I think the correct way to insert code is by wrapping it in a shortcode. So instead of < pre > you would use:
[javascript]
// your code here
[/javascript]
If neither of these sounds like an ideal solution (or works) there are a bunch of other syntax highlighter plugins for self-hosted WordPress that might be better: http://wordpress.org/extend/plugins/search.php?q=syntax+highlighter
Hope this helps - best of luck!
Agree with #Michelle.
This actually works for me.
[sourcecode language='javascript']
//Replace 'javascript' by the corresponding language
//Your code goes here
[/sourcecode]
It will work on save or update for hosted and non hosted sites.
Example.
To apply it to your text, you just have to switch to the 'Text' visual editor.
Your pages will load faster if you do the syntax highlighting before posting, using pygmentize: http://permafrostcodingstudio.com/articles/syntax-highlighting-in-posts/
It's a little more complicated, but worth being able to disable a plugin. Wordpress will run faster and be more secure with fewer plugins installed.
Well I want to use Google api translator in my website and when I am putting this api code in my html page it's working fine.
----------------------------------google translator code :-----------------------------
<div id="google_translate_element" ></div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en'
}, 'google_translate_element');
}
</script><script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
I want to put the code in when I am putting this code in iframe then it shows everything.
But while changing the language it changes the language of elements in the iframe it doesn't affect outside the iframe.
I guess this is why the iframe tag is used to include an external document into an existing one.
Google Translator will translate the content of the iframe only, since it has no clue about the container document.
Please see also:
http://forums.macrumors.com/showthread.php?t=467248