Search Unity

OneSky translation API implementation questions...?

Discussion in 'Scripting' started by exerion, Apr 10, 2016.

  1. exerion

    exerion

    Joined:
    Jun 29, 2011
    Posts:
    54
    Hi :)

    I'm looking at using the OneSky translation API on my next project. Has anyone successfully done this?

    I'm a noob when it come to anything regarding web communication. I've looked through the documentation but can't get anything working. I just get the error...

    WWW.error: Rejected because no crossdomain.xml policy file was found

    I've tried googling the error but couldn't find anything that I understood or helped. Any assistance is greatly appreciated! =D Here is some code...

    Code (CSharp):
    1.     public string SecretKey;
    2.     public string Url;
    3.  
    4.     void Start()
    5.     {
    6.         StartCoroutine(Test());
    7.     }
    8.  
    9.     IEnumerator Test()
    10.     {
    11.         string currentTime = CurrentUnixTimestamp().ToString();
    12.         string dev_hash = GetMD5Hash(string.Concat(currentTime, SecretKey));
    13.  
    14.         string url = Url + "/1/project-types?"
    15.                      + "api_key=" + SecretKey
    16.                      + "&timestamp=" + currentTime
    17.                      + "&dev_hash=" + dev_hash;
    18.  
    19.  
    20.         WWW www = new WWW(url);
    21.         yield return www;
    22.  
    23.         if (www.error == null) {
    24.             Debug.Log("WWW.text: " + www.text);
    25.         } else {
    26.             Debug.Log("WWW.error: " + www.error);
    27.         }  
    28.     }
     
    Last edited: Apr 13, 2016
  2. exerion

    exerion

    Joined:
    Jun 29, 2011
    Posts:
    54
    Is anyone using a translation API? ...or are you simply emailing a CSV/XLS file that gets translated and returned?

    Thanks :)
     
  3. exerion

    exerion

    Joined:
    Jun 29, 2011
    Posts:
    54
    I'd just like to report that OneSky support was unable to help me, seemingly through lack of knowledge rather than lack of effort, so I've put this on the backburner for now.

    If anyone manages to get this working please post your findings. Thanks :)