Step-by-Step Guide to Implement Language Options in the API
Step 1: Navigate to the API Documentation
- Go to the Divine API documentation.
- Click on Western API in the left menu.
- You’ll see options like Natal Astrology, Synastry, and Transit.
- Select an API for language configuration. In this guide, we’ll use the Natal Astrology > Planetary Positions API as an example.
Step 2: Access Supported Language Codes
In the Planetary Positions API page, locate the Supported Language Codes dropdown.
This section provides a list of language codes that you can use in requests to receive responses in different languages.
Here are some of the supported language codes:
en
- Englishhi
- Hindipt
- Portuguesefr
- Frenchde
- Germanja
- Japanesetr
- Turkishru
- Russianit
- Italianes
- Spanishnl
- Dutchpl
- Polish
Step 3: Set the Language Parameter in Postman
In your Postman, add the lan
parameter in the body section to specify the preferred language.
For example, to receive the response in Portuguese, set "lan": "pt"
in the request body.
Here’s a sample JSON request format:
{
"api_key": "your_api_key",
"full_name": "John Doe",
"day": 10,
"month": 7,
"year": 1985,
"place": "New Delhi, India",
"lat": 28.7041,
"lon": 77.1025,
"tzone": 5.5,
"lan": "pt", // This sets the response language to Portuguese
"house_system": "P" // Example house system code
}
Step 4: Send the Request and Receive a Localized Response
After configuring the language code in the request, submit the request to the API endpoint.
The response will contain the astrological data in the specified language.
Example in Postman:
- Open the Postman application.
- In the Body section, enter the necessary parameters, including the language code (
lan
). - Click Send to submit the request.
- Review the response in your chosen language format.
Step 5: Check the Response for Correct Language Formatting
- Verify that the response is in the selected language, ensuring a localized experience for your users.
- If the response is not in the specified language, check the language code for accuracy or consult the API documentation for support.
Important Note: Always ensure the language code used is supported by the API. Using an unsupported code may cause the API to default to English or return an error.
Supported Language Codes Reference
For a detailed list of supported languages, refer to the Supported Language Codes section in the API documentation or consult the support documentation.
Step 5: Conclusion
The Natal Astrology API’s multilingual support allows you to provide astrological insights in users’ preferred languages, enhancing global accessibility. By setting the correct language codes in your API requests, you can offer a personalized, localized experience. Refer to the API documentation for supported languages and start delivering a more inclusive user experience.