How to Add Localization to Bucket Object Types


Below is a step-by-step tour of how to add the power of Localization to your Cosmic JS Object Types.


1. Localization happens on the Object Types.  To set up localization in your Bucket go to Your Bucket Dashboard > Object Type > Settings (Cog icon)



2. Then turn localization for this Object Type “On”


3. Select your locales



4. Select your priority local (this will be the display title in the Objects Table)



5. Then on your Object Pages, you will see the Locale option



6. When you want to add the same Object (but in a different language / locale) simply create a new Object, *make sure the slug is the same* and add the different locale


7. Save this Object, then you will see that the Object now appears in the Table with 2 different locales linked


8. Now that you have the 2 versions, you can get the different versions from the API endpoint using the `locale` query param

EN Version:
https://api.cosmicjs.com/v1/install/object/aquamarine?pretty=true&hide_metafields=true&locale=en-US

ES Version:
https://api.cosmicjs.com/v1/install/object/aquamarine?pretty=true&hide_metafields=true&locale=es

This `locale` parameter is available on all endpoints, so if you need to get all Objects with `locale=es`:
https://api.cosmicjs.com/v1/install/object-type/products?pretty=true&hide_metafields=true&locale=es

Or EN:
https://api.cosmicjs.com/v1/install/object-type/products?pretty=true&hide_metafields=true&locale=en-US


I hope you found this article helpful.  Let me know if you have any further questions.  Reach out to me on Slack, and follow Cosmic JS on Twitter.

Was this article helpful?

Thank you! Your input helps us improve our articles and resources. If you have any other questions or comments, please contact support.

You may also like


Cosmic JS allows developers to deploy their codebases to the Cosmic JS App Server for staging, testing and demo purposes, and is now offering new production deployment options available with some of your favorite deployment services.
E-commerce app built with Gatsby JS and Cosmic JS app. Here Cosmic JS is used as a database as well as a server.
Tony Spiro, co-founder and CEO of Cosmic JS, presented "Building for Team Success with Content-Powered Apps" to illustrate the build vs. buy concept of software development in the API-first microservices movement. The full video is embedded below and runs approximately 45 minutes.
This application was mainly inspired by Offerup, Letgo, and Craigslist. Like Craigslist, LetGo allows you to buy and sell items locally, which means you don’t have to deal with the hassles of shipping like you would on eBay or Amazon. With 30 million users, it is more popular than OfferUp...
Here we build a progressive web app in React.js with the power of Cosmic JS. It respond with status 200 and carries data when you disconnected to internet and in Chrome browser (both mobile and desktop) it gives an option to install the app on home screen.
In this tutorial I'm going to show you how to create a "Conference" app using a little bit of Node, and Cosmic JS.