Get started with Free ISO639 Language Codes API

Understanding ISO639 Language Codes API

Do you know, for some cultures, there might be more than one way to name the same language? Just like the official language of China, Mandarin, you can also name it as “Hanyu” or “Putonghua”. Is there a universal recognised standard to represent languages in the exchange of information? The answer is yes, with ISO639 Language codes. In this blog post, we will show you how to create a ISO639 Language Codes API with the least effort and a free access. Read on and get started!

What exactly are ISO639 Language Codes?

By definition, ISO639 Language Code is a set of standards by the International Organization for Standardisation that is concerned with representation if names for languages and language groups. It is applied for bibliographic purposes, by libraries, information services, and publishers to indicate language in the exchange of information.

Different types of ISO639 Language Codes

Part 1: ISO639-1:2002 provides an alpha-2 code (2-letter code) that has been designed to represent 136 major languages over the world. Typical examples of ISO639-1 codes includes:

CodeLanguage
enEnglish
deGerman
frFrench
esSpanish

Part 2:  ISO639-2:1998 provides an alpha-3 code (3-letter code), which offers more possible combinations to cover more languages. There are in total 464 codes included. This coding system allows for grouping of collective languages like:

CodeLanguage Group
batBaltic Languages
celCeltic Languages
gemGermanic Languages
korKorean Languages

Part 3: ISO639-3:2007 provides a 3-letter code just like ISO639-2 but it aims to provide as complete a listing of languages as possible, including extinct and ancient languages as well as languages that are still around today.

Part 4:  ISO639-4:2010 gives the general principles of language coding and lays down guidelines for the use of ISO 639.

Part 5:  ISO639-5:2008 provides a 3-letter code for language families and groups (living and extinct).  This code further expands on the grouping carried out in ISO639-2.

Part 6: ISO639-6 is the most recent coding system developed and is a 4 letter code that allows us to distinguish between variants of languages and language families. It aims to distinguish between as many enumerations of languages in the largest possibility including extinct, living, ancient, major, minor languages and even includes all written, spoken and signed languages. The ISO-6 coding system establishes a hierarchical framework which indicates a historical timeline of languages as the code links each language to its principle ancestor. For example:

CodeLanguages
engEnglish Language
emenEarly Modern English
emseEarly Midland and South Eastern Middle English
mengeMiddle English
angoAnglo Saxon
anglAnglic
nseaNorth Sea
gmcwGermanic West
grmcGermanic

You may check out the complete ISO639 Language Codes list here.

What is an API?

We all know that there are somethings we just don’t want do it manually. That’s where APIs come in. An API, or application programming interface, is a set of rules and specifications that allow two software programs to communicate with each other. Developers can build applications that work seamlessly together and make it possible for end-users to complete complex tasks with just a few clicks. By using an API, you can save yourself time and effort of having to write your own code from scratch. Let’s take a closer look at what an API is and how you can use it in your own development projects. If you want to know more about what an API is, check this link out.

For example, imagine being able to book a flight, hotel, and rental car all in one place by using just a few taps on your smartphone. This would not be possible without APIs! As the world becomes increasingly interconnected, the importance of well-designed APIs will only continue to grow.

Advantages of using a ISO639 Language Codes API

ISO639 Language Codes API offers various advantages while work with Language Codes programmatically. Here are some of them:

1. Provides automatic processes

ISO639 Language Codes API makes use of the program to provide you a seamless process to get information from and verify language codes. Simply inject the use of this API into your working application or software products, you would enjoy a smooth workflow and a swift experience for you and your end-users.

2. Provides an integration

ISO639 Language Codes API allows to make it simpler for your content to be incorporated into other parts of your website or applications. Therefore, you can provide a smooth and integrated user experience, and relevant and up-to-date information, for your end-user.

Create a sample ISO639 Language Codes API

Why should you choose this server?

The ISO639 Language Codes API is supported by OpenAPIHub, an All-in-one API Platform that supports API Needs and it is certified as “AWS Qualified Software” since 2022. You can register for an API portal for free, share and monetise APIs easily on the trustable platform certified by ISO27001.

Features

Using this tool, you can either get the language’s ISO code information or verify a language ISO code.

Prerequisites

You will need a suitable API provider. Using ISO APIs’ ISO639 Language Codes API, you can proceed easily as follows :

1. OpenAPIHub Developer Account

You need to sign up for an OpenAPIHub developer account in order to subscribe and access this API. For more information, please refer to “Register as a Developer“.

2. Active API Subscription

You need to subscribe to this API before consuming it. Many APIs come with a free trial plan so that you can experience the API functions provided free of charge. For more information, please refer to “Subscribe to APIs“.

3. API Credential

An API Key is required to access the API. It can be obtained in the Developer Admin Portal once you have completed the signup to OpenAPIHub. For more information, please refer to “Create API Key“.

API Endpoints

lang-iso-code-info

isoVersionNumber = "2"
languageCode = "kor"


//=> {"name":"Korean", "local":"한국어", "1":"ko", "2":"kor", "2T":"kor", "2B":"kor", "3":"kor"}

lang-iso-code-verify

{ "isoVersionNumber" : "2", "languageCode" : "kor" }

//=> true

You may check out the full API documentation here in the OpenAPIHub.

Making an User Interface

We are here to guide you with detailed steps. Let’s get into first part – creating an user interface for users to enter their API parameters.

A sample user interface

 Try this HTML yourself!

<div id="app">
  <div class="demo-description">
    <h2>ISO639 Language Code</h2>
    <span>To protect your credentials.</span>
    <br>
    <span>DO NOT save this API Key in the code sandbox!!</span>
  </div>
  <div class="test-area">
    <div class="input-area">
      <span>API Key</span>
      <input
        type="text"
        placeholder="Input your key here"
        v-model="apikey"
      >
      <br>
      
      <span>Mode</span>
        <select v-model="mode">
          <option value="info">Get Info</option>
          <option value="verify">Verify Code</option>
        </select>
      <br>
      
       <span>ISO Version</span>
       <select v-model="isoVersionNumber">
          <option value="1">1</option>
          <option value="2">2</option>
          <option value="2B">2B</option>
          <option value="2T">2T</option>
          <option value="3">3</option>

        </select>
       <br>
      
        <span>Language Code</span>
        <input
          type="text"
          placeholder="Language"
          v-model="languageCode"
        >
        <br>
           
      <button v-on:click="convert">{{ isInfo ? 'Get Info' : 'Verify' }}</button>
    </div>

    <div class="output-area">
      <template v-if="error">
        <span v-html="error" />
      </template>
      <template v-else-if="!result">
        Fill in the API Key and select mode, then fill in the needed information and press "Verify" or "Get Info".
      </template>
      <template v-else>
        <div v-html="result" />
      </template>
    </div>
  </div>
</div>

Applying CSS on the interface

After creating the basic structure to get user input for the parameters, we need to add the following CSS to decorate our UI to make it more attractive!

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap');
body {
  background: #20262E;
  padding: 20px;
  font-family: 'Open Sans', sans-serif;
}
 
#app {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  transition: all 0.2s;
  /* height: 400px; */
}
 
.demo-description {
  text-align: center;
  margin-bottom: 20px;
}
 
.demo-description h2 {
  font-weight: semibold;
  margin-bottom: 5px;
}
 
.demo-description span {
  color: #999999;
}
 
.test-area {
  display: flex;
}
 
.input-area {
  text-align: right;
}
 
.input-area span {
  display: inline-block;
  line-height: 48px;
  margin-right: 8px;
  text-align: right;
  width: 150px;
}
 
.input-area input, select {
  border: 1px solid #999999;
  border-radius: 3px;
  height: 30px;
  width: 150px;
  padding: 0 7px;
}

.input-area select {
  height: 32px;
  width: 166px;
}
 
.input-area input::placeholder {
  color: #d0d0d0;
}
 
.input-area button {
  background-color: #57abf0;
  border: 0;
  border-radius: 4px;
  color: #ffffff;
  font-weight: 600;
  margin-top: 15px;
  width: 166px;
  padding: 15px 10px;
}
 
.output-area {
  color: #505050;
  font-size: 14px;
  margin: 20px;
  margin-right: 0px;
  width: calc(100% - 350px);
}
 
@media screen and (max-width: 616px) {
  .input-area {
    text-align: center;
  }

  .input-area span {
    text-align: left;
  }
   
  .output-area {
    width: calc(100% - 150px);
  }
   
  .input-area button {
    width: 140px;
    padding: 10px 7px;
  }
}
 
.output-area svg {
  transform: scale(0.7) translateX(-30px) translateY(-95px);
}

Interact your UI with Vue.js

In the script, we will interact the interface with our provided API endpoints using the script below:

const endpoint = 'https://trial-api-langs-2nyc.gw.openapihub.com/langs/lang-iso-code-';

new Vue({
  el: '#app',
  data() {
    return {
      apikey: '',
      mode: 'info',
      isoVersionNumber: '1',
      languageCode: 'ko',
      isInfo: true,
			result: '',
      error: ''
    }
  },
  watch: {
  	mode: function(newMode) {
    	if(newMode === 'info') {
      	this.isInfo = true
      } else {
      	this.isInfo = false
      }
    }
  },
  methods: {
    convert: function() {
      const axiosConfig = {
        headers: {
          'content-type': 'application/json',
          'x-openapihub-key': this.apikey
        }
      }
			
      const params = {
        'isoVersionNumber': this.isoVersionNumber || undefined,
        'languageCode': this.languageCode || undefined
      }
      
      if (this.isInfo) {
        axios.get(`${endpoint}${this.mode}`, {
            params: params,
            headers: axiosConfig.headers
        })
        .then(res => {
            this.error = ''
            this.result = `Result -<br>${JSON.stringify(res.data).replaceAll(',',',<br>')}`
         }).catch(err => {
            this.error = `Error occurred -<br>${err.response.data.message}`
            console.log('Error', err.response.data.message)
       	})
       } else {
       	axios({
        		method: 'post',
        		url: `${endpoint}${this.mode}`,
            data: params,
            headers: axiosConfig.headers
        })
        .then(res => {
            this.error = ''
            this.result = `Result -<br>${JSON.stringify(res.data).replaceAll(',',',<br>')}`
         }).catch(err => {
            this.error = `Error occurred -<br>${err.response.data.message}`
            console.log('Error', err.response.data.message)
       })
      }
    }
  }
})

Now that we have all the materials prepared. Let’s take a try on getting some information of a sample language code.

Simply fill in the API Key and select mode, then fill in the needed information and press “Verify” or “Get Info”.

And the output is as follows:
ISO639 Language Codes sample output
A sample output

Conclusion

While representing languages using their names, it is a perfect choice to identify them with their corresponding ISO639 language codes. By understanding how they work and how to create a ISO639 language codes API, you can get information or verify a language code whenever and in whatever software products you are developing. Here, we provided you the easiest way to complete the task. Don’t hesitate, try it yourself now!

Next Steps?

Just to make it even easier for you, the sample ISO639 Languages Code API that you just use right away is powered by OpenAPIHub. So what are you waiting for? Try out our API Now in OpenAPIHub and see how easy it is to facilitate your business, projects or work now! 

OpenAPIHub is an API Platform that help you define API subscription and enable API Monetization with ease. Check the following 2-min What is OpenAPIHub video for more and try OpenAPIHub for Free!

Ready to Start Your API Journey?

Join OpenAPIHub and connect to the fast growing API Hub Community to grow your API Business today!

Start for Free