I am building a quiz game for both iOS & Android platforms and I want to be able to handle localization.
I am using Firebase's realtime database solution in order to pull all of the question the game is going to have. I am hardcoding the questions into the Firebase's database and every question object has 2 parameters:
ID - Obviously
Text - The question text itself e.g. "Who was John Kennedy?"
I am having hard time thinking about how to localize the questions I am pulling from Firebase. Obviously if the app is localized as Spanish I want to get the questions text translated to Spanish.
How do I go about it?
Thank you very very much :)
By the end of this tutorial, you'll be able to: Track individual driver's location, with their permission, using HTML5 Geolocation API after logging into the app. Store authenticated driver's location data to the Cloud Firestore as the location changes.
After you set your project's default GCP resource location, you cannot change it. If you set up Cloud Firestore or Cloud Storage, you're prompted to select your project's default GCP resource location in the Firebase console workflow.
Yes, You can use the same firebase database in more than one android application as below: In the Project Overview section of Firebase Console add an android application. For adding this application first you need to give that package name.
By using the updateChildren() method of the database reference class, we can write the HashMap data structure into Firebase Realtime Database.
Database like this...
{
"en": { "Q1": "Who was JFK?" },
"es": { "Q1": "¿Quién era JFK?" }
}
Accessed like this (JavaScript)...
var locale = fooLocale() || 'en'; // get locale, fallback to English
var firedb = firebase.database(); // init database
var content = firedb.ref(locale); // get reference to locale data
content.child('Q1').on('value', function (snapshot) { // request Q1
document.getElementById('Q1').innerHTML = snapshot.val(); // set UI text
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With