How to translate facebook location - facebook-graph-api

I´m using the FB:registration Plugin and it returns me as location an Array with something like Munich, Cologne, etc. I want them translated into german and save them as München or Köln.
How is this possible?

Try using the google translate API:
https://www.googleapis.com/language/translate/v2?key=INSERT-YOUR-KEY&q=Munich%20Cologne&source=en&target=de

Related

How to generate Django template as MS word?

Is there a way to build a Django template or make it like Microsoft word by making the Django template have tools and the ability to write word documents from a website instead?
if we supposed that there is a domain name called: example.com
so, when I open that website for example.com/word-doc/ it will open a blank page and some tools from Microsoft Word to write in.
Is there any package or API to do so?
You are probably looking for a kind of "wysiwyg" editor for client side (this part has nothing do with Django). The closest thing I could found is this one, however it comes with a price tag.
In Django-side you'll (probably) simply store the data given by editor (client). The editor will then be able to parse it for update/read purposes.

How to set text dynamically in unreal engine

I would like to set text and 2d images dynamically in Unreal Engine maybe using a placeholder like a Billboard Blueprint then using the Set Text Blueprint.
I am getting json from an external source -- amazon product information -- then want to update the UI Billboard with this json result which includes text and links to image files.
Does anyone know how to achieve this.
Create the string:
FString TestHUDString = FString(TEXT("Buy this crap!"));
FStrings can be set/modified during runtime just like you want it from a std::string
TestHUDString = "buy this other crap....";
And (for example) write it to the "screen":
Canvas->DrawText(BigFont, TestHUDString, 110.0f,110.0f);
You man need to convert your data to a c string or UTF-8 if you have Problems.
Theres also text components of objects if you want to create "in world" billboards for example.
Here the official documentation about using FStrings:
https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/StringHandling/FString/
This should help assuming that you know how to deserialize the json - wich is a different topic imho.

How can I use a regex to validate slideshare slideshow URLs?

I am using www.slideshare.net to allow my users to display embedded slideshows on their profiles.
I'm using slideshare's api to get the slideshow's id, given the slideshow link that users has to get by clicking 'share' on the slideshow and copy/paste the url:
What I would need is to validate thoroughly the latter url.
Just to further explain my process, when I have the slideshow's id, I compute the embedded code like so :
"<iframe src='https://www.slideshare.net/slideshow/embed_code/" + json.slideshow_id + "' frameborder='0' allowfullscreen webkitallowfullscreen mozillaallowfullscreen></iframe>"
where json is the object returned by slideshare's api.
A basic regex to answer my question would be:
^http\://www\.slideshare\.net/[a-zA-Z0-9\-]+/[a-zA-Z0-9\-]+$
But it feels a little weak to me :
I don't want my users to just copy/paste the url in the navigator address bar
I'm not sure this regex works for all slideshare's slideshows as I'm not a slideshare specialist (does that even exist?)
Ideally I would like to exclude all other regular urls from www.slideshare.net that doesn't point to a slideshow.
EDIT 7/12/2014: rewrite
You can use something like this:
(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,#?^=%&:/~\+#]*[\w\-\#?^=%&/~\+#])?
More example from this website

Translate xml content using web service API from Ektron CMS400.Net

First of all: I'm on Ektron CMS v8.1
I'm having a problem with dynamicly adding translated content to the cms via the Webservice API. I can perfectly add xml content by using the following object and method:
ContentSoapClient csc = new ContentSoapClient("ContentSoap");
csc.AddContent3(...);
I specify a language and the xml content gets inserted. But now I want to add a translated version of the xml to the cms. So I want it to have the same contentId!
Anyone has an idea on this? The only method in the csc object that recieves a contentId is 'csc.AddContent2(..)' But that doesn't import anything and just gives me an error saying my xml is incorrect. While my xml is correct..I checked it!
Thanks!
Found the answer..
Ektron apparantly uses alot of asmx files and I only checked the "/workarea/webservices/WebServiceAPI/Content/Content.asmx" webservice. I found the method 'AddTranslatedXMLContent()' I need in the "/Workarea/webservices/ContentWS.asmx" webservice.
I wish they just cleaned up their API... Would save us a lot of trouble.
Firstly, I haven't used the ContentSoapClient class and can't find any documentation on it.
Ektron often takes a language id when you create the API object. See if the ContentSoapClient contructor can take a Language Id.

How can I access django admin's transliterator for slugs when using fixtures?

In the admin, if you enter in a slug two things are applied through JS:
The string is made slug-friendly
The string is transliterated if the language is not English, so for example Cyrillic Russian text gets converted into Transliterated Russian ( typed out in English )
I'm basically inserting a couple thousand rows and I need to access this. Does django provide a non-js server-side version of this transliterator which I can access to somehow do the insertion?
Looks like I have to port over the usr/lib/pymodules/python2.5/django/contrib/admin/media/js/urlify.js code unless I can figure out a way to programmatically load all articles on the client side and slugify themselves automatically.