Language Detection API

                Smart Techie

                When I was reading some article, I found some other language words appeared in that article. I was fascinated to know for what language those words belong to and searched for an API to detect the language based on the content which we are providing. I found a simple API to do the job here. Follow the steps to work with this API.

  • Register here to get the API key.
  • Create maven project and add the below dependency to pom.xml


Write a simple java code by using API to detect the language of context. The code is provided below.

package org.smarttechie;

import java.util.List;

import com.detectlanguage.DetectLanguage;
import com.detectlanguage.Result;
import com.detectlanguage.errors.APIError;

public class LanguageDetector {

* @param args
* @throws APIError
public static void main(String[] args) throws APIError {
DetectLanguage.apiKey = "[YOUR API KEY]";
List results = DetectLanguage.detect("ಕನ್ನಡ ಲಿಪಿ");

Result result = results.get(0);

System.out.println("Language: " + result.language);


Once you run the above code, it will detect the language code as “KN” [KANNADA].

The source code is available here.


Siva Janapati is an Architect with experience in building Cloud Native Microservices architectures, Reactive Systems, Large scale distributed systems, and Serverless Systems. Siva has hands-on in architecture, design, and implementation of scalable systems using Cloud, Java, Go lang, Apache Kafka, Apache Solr, Spring, Spring Boot, Lightbend reactive tech stack, APIGEE edge & on-premise and other open-source, proprietary technologies. Expertise working with and building RESTful, GraphQL APIs. He has successfully delivered multiple applications in retail, telco, and financial services domains. He manages the GitHub( where he put the source code of his work related to his blog posts.

Tagged with: , ,
Posted in Natural Language Processing
One comment on “Language Detection API
  1. Anonymous says:

    Hi there,I checked your article named “Language Detection API”. Your writing style is nice, keep doing what you`re doing!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.


Java Code Geeks
Java Code Geeks
%d bloggers like this: