Recaptcha translation - recaptcha

Does anyone know how to change text language from Recaptcha?
I've already tried:
<script type="text/javascript">
var RecaptchaOptions = {
lang : 'fr',
};
</script>
But it doesn't change.

For the reCAPTCHA V2 widget you can override the default interface language detection as a parameter to the javascript. See the new docs.
<script src="https://www.google.com/recaptcha/api.js?hl=fr"></script>

set your lang at last of api address (persian "farsi"):
https://www.google.com/recaptcha/api.js?hl=fa
find your language short name in https://developers.google.com/recaptcha/docs/language

Append &hl=fr to the public key.

Appending the language code to your public key work very well :
define('RECAPTCHA_PUBLIC_KEY', '__YOUR_PUBLIC_KEY_HERE__&hl=fr');
echo recaptcha_get_html(RECAPTCHA_PUBLIC_KEY);
So you can remove your JavaScript from your code. Or leave it if you use other options, but remove "lang:'fr'"

If you mean the language in the actual images that you are trying to solve, unfortunately you can't change the language of that text, at least not yet. The only thing you can change is the language of the interface (the text/prompt in the widget, etc.).
Response to comment: well, according to the docs, you seem to have it right. Is this code place in the same page where the widget appears?
The docs also say:
you need to add the following code in your main HTML page anywhere before the <form> element where reCAPTCHA appears (this will not work if placed after the main script where reCAPTCHA is first invoked)
so also make sure that this code is placed before the <form> tag which encloses the reCAPTCHA widget.

RecaptchaOptions is never working.
Another solution is to add a parametrt hl= langCode while we including the captcha script
<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . &hl=de">/script>

You pasted the incorrect js. There should not be a comma after lang: 'fr'. The correct code is:
<script type="text/javascript">
var RecaptchaOptions = {
lang : 'fr'
};
</script>

Related

Edit hyperlink validation

Is there any possibility to add another protocol to the hyperlink-type in sharepoint?
I want to add a notes (notes://***) to the top level navigation-bar.
Is there something I can extend or where I can edit the validation
By default, SharePoint navigation Hyperlinks must begin with http://,https://,mailto:,ftp://,file://,/,# or \.
If you want to use the "notes://***", as a workaround, you can add the link using jQuery code.
<script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$(".ms-core-listMenu-horizontalBox>ul>li>ul").append("<li class='static'><a href='notes://xxx'>MyNote</a></li>");
});
</script>
Probably it is not possible to turn off easily the OOB link validation without any customization. Depends on the output You need maybe You could use a note column and in edit HTML content of the filed just put the link tag manually like:
someLink
. After save SharePoint will render it as link on list webpart.

Bootstrap typeahead is not displaying AJAX results

Before asking I want to say that this is not a duplicated topic. I've already tried with:
Pwarelis' fork
Tcrosen's one
Gudbergur's code
...and many others, and I also read lots of Q&A, but none of them is what I am looking for.
All what I tried works with predefinite string sources, but when I do the next step: AJAX remote source, it is just showing no results on the dropdown list.
UPDATE - My code (don't understand why negative votes. Well written, well strucuted ;))
The html file
<html>
<head>
<link href="./bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
</head>
<body>
<input id="myElement" class="typeahead" type="text">
<script src="./js/jquery.js"></script>
<script src="./bootstrap/js/bootstrap-typeahead.js"></script>
<script language="javascript">
$('#myElement').typeahead({
ajax: '/php/ajax.php'
});
</script>
[...]
The ajax.php file:
<?php
echo "[{ id: 1, name: 'Terry'}, { id: 2, name: 'Mark'}, { id: 3, name: 'Jack'}]";
?>
It's not an AJAX issue, because it is working in other cases at the same machine.
What may I try to fix it?, I am really crashing up my head since a few days. Thanks for reading.
People who vote negative without even knowing the right answer should think a bit before acting. If someone needs a real nice/working/magic autocomplete script, here wo go:
Real good Autocomplete Script
Description: This adds a pulldown menu of suggested values to a text field. The user can either click directly on a suggestion to enter it into the field, or navigate the list using the up and down arrow keys, selecting a value using the enter key. The values for the suggestion list are to provided as XML, or as JSON (by a PHP script, or similar).
Thanks those who made negative points disappear ;)
hey set header of json in you php file
use header('Content-Type: application/json');
for more info on header plese visit here(stackoverflow question) ad for example visit here(www.funnenjoy.com)

Custom CSS for Google Custom Search Engine

How can I customize CSS for Google Search Engine. Currently I use a theme:
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1',
{language : 'en', style : google.loader.themes.ESPRESSO});
.....
But I want to change the font colors/sizes.
On the official guide https://developers.google.com/custom-search/docs/js/cselement-devguide
I see a link:
Modify result CSS properties - The Custom Search element uses Search Control result styles, which you can modify to change basic look and feel.
Which is broken (leads to 404). Surfing the Internet didn't bring results. Is there a way to do that?
They just moved it under another URL but forgot to update it in their documentation:
was
https://developers.google.com/apis/websearch/docs/#StylingSearchResults
became
https://developers.google.com/web-search/docs/#StylingSearchResults

Razor #if inside <script> is rejected by VS11

Is the following markup incorrect, or is it a bug in the Razor engine in MVC4? Either way, what's the best workaround?
The entire content of View1.cshtml is shown. It compiles fine, but the Intellisense error highlighting is annoying. (Included as an image so you can see how the syntax is rejected by VS11.)
Hote that the #: syntax (instead of <text></text>) isn't accepted either.
It's a little tricky to mix JavaScript with Razor. Personally, I find it easier to always separate these two guys by using either Razor #function or Razor custom #helper.
Here's a simple example:
<script type="text/javascript">
function btn_clicked() {
#generateMyJavaScript()
}
</script>
<a href="javascript:void(0)" onclick='btn_clicked()'>Click on me</a>
#functions {
private MvcHtmlString generateMyJavaScript()
{
string jsBuilder = string.Empty;
if (true)
jsBuilder = "alert('Hey!');";
return MvcHtmlString.Create(jsBuilder);
}
}
I noticed strange behavior of the syntax highlighter too. This is not really an answer but:
I try staying away from mixing model data into javascript. Although powerfull it is a bit spaghetti-like.
Also I try to have as little as possible tags in the html. I use js includes and jQuery $(document).ready(function () ... functions inside those.
There you can extract the JSON data from the data attributes and base javascript decisions on those.
(Wanted to write this as a comment but didn't find the way to do that, sorry for the debump)

Is there a way of making normal links automatically load through ajax, rather than normally?

I haven't explained this well.
But what i mean is, if I have an ajax script that loads the content of a page in a DIV element, through the function 'loadpage('whatever.php');, instead of going around manually doing this to all links, is there a way of having a script that automatically makes all regular links load through that ajax function?
Like on Facebook, your profile loads through ajax, yet if you look at their code, they just have a regular link to the profile.
Cheers!
Sure, you can do it with jQuery.
This script goes through the document, finds every anchor element and binds an event handler to the click event of each. When the anchor element is clicked, the event handler finds the href attribute and loads that page into #targetDiv (you can call this div whatever you want, of course).
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function() {
$("a").click(function() {
$("#targetDiv").load(($(this).attr("href") + " body");
return false;
});
});
</script>
...
<!-- In your document body, this is the div you'd load the pages into. -->
<div id="targetDiv"></div>
You can use JQuery for this (if I understand your question right).
First you can make the function loadpage() as follows:
function loadpage(divId, url) {
$('#' + divId).load(url);
return false;
}
.load() isn't supported by all browsers though. If you want to do this without .load() then you can check out .get(). For more info on .load(), take a look at http://docs.jquery.com/Ajax/load
I'm assuming it would go something like this:
$(document).ready(function(){
$("a").click(function(){
$("body").load($(this).attr("href") + " body");
return false;
});
});
This would make all <a> tags on the page call a function that downloads a HTML document from the href attribute of the tag, strip out it's body tag, and replace the contents of the current page's body tag with the contents of the new body tag. This way, it's easier to work this with no JavaScript, as well as integrate it into an existing site.
To use it, you place this into a <script> tag in the head of your main page, or in an external JS file.
Please note, however, that this code only updates the contents of the <body> tag, the head (including the title tag) remains untouched. You may need to add extra code to update things like this.
Simple and Nice. Check this out:
Bjax
Usage:
<script src="bjax.min.js" type="text/javascript"></script>
<link href="bjax.min.css" rel="stylesheet" type="text/css" />
Finally, include this in the HEAD of your html:
$('a').bjax();
For more settings, checkout demo here:
Bjax Demo

Resources