Dakwak API: Get Translation

Dakwak Get Translation API allows you to request a translation for a phrase, by choosing a language to translate to and the level of translation. By default, it will return the published translation of the given term. If that doesn’t exist, the best unpublished translation will be returned instead.

Request

Send a GET request to the following:
dakwak.com/api/translate.json?apikey=API_KEY&lang=LANG&phrase=PHRASE

Then, replace the bold capitalized words with their corresponding values:

  • apikey: this is long unique string used to identify your website, and to allow you to access the search API. To request your website’s API Key, go to Dashboard -> My Website Content -> Settings then click on blue the button “Request API Key”. An email will be sent to the support staff at dakwak and they will contact you with your website’s API Key.
  • phrase: the phrase you want to translate
  • lang: the language of the translation you want. Use the shortcut of the language, based on this table:
    Language Shortcut Language Shortcut Language Shortcut
    Afrikaans af Greek el Romanian ro
    Albanian sq Hebrew iw Russian ru
    Arabic ar Hindi hi Serbian sr
    Belarusian be Hungarian hu Slovak sk
    Bulgarian bg Icelandic is Slovenian sl
    Catalan ca Indonesian id Spanish es
    Chinese (Simplified) zh-CN Irish ga Swahili sw
    Croatian hr Italian it Swedish sv
    Czech cs Japanese ja Thai th
    Danish da Korean ko Turkish tr
    Dutch nl Latvian lv Ukrainian uk
    English en Lithuanian lt Vietnamese vi
    Estonian et Macedonian mk Welsh cy
    Filipino tl Malay ms Yiddish yi
    Finnish fi Maltese mt Urdu ur
    French fr Persian fa Chinese (Traditional) zh-TW
    Galician gl Polish pl French (Canada) fr-CA
    German de Portuguese (Europe) pt-PT Spanish (Latin America) es-LA
    Portuguese (Brazil) pt-BR

The request should look something like this:
dakwak.com/api/translate.json?apikey=12356789abcde&lang=ar&phrase=hello
Or, if you want to get the spanish translation:
dakwak.com/api/translate.json?apikey=12356789abcde&lang=es&phrase=hello

Response

When you send the request, and if all fields are valid, you will get a response that looks like this:

{"apikey": "12356789abcde",
"lang": "es",
"phrase": "hello",
"translation": "hola"}

  • apikey, lang and phrase fields contain the same values of the request
  • translation: the requested translation of the phrase. By default, the published translation will be returned. If no published translation exists, the unpublished translation with the highest level will be returned instead.

Error codes

If you get an error instead of search results, it means your request contains invalid information or misses some required information. Please check the correct request format.

  • 1100: ‘apikey’ is a required field
    You left the apikey field empty, didn’t include it in your request, or misspelled ‘apikey’
  • 1101: ‘lang’ is a required field
    You left the lang field empty, didn’t include it in your request, or misspelled ‘lang’
  • 1103: ‘phrase’ is a required field
    You left the phrase field empty, didn’t include it in your request, or misspelled ‘phrase’
  • 1300: apikey must be valid
    You used a wrong API key; make sure you copy the full API key of your website
  • 1301: language is not valid or supported
    The language you requested is not supported by dakwak.com or does not exist. Make sure to choose the correct language shortcut from the table above
  • 1500: language is not included in your plan
    The language you chose is not included in your plan, please choose another language
  • 1400: could not find the requested phrase
    The phrase in your request has not been translated yet