I'm deep into a project right now and I've been saving currencies and languages as simple IDs (like 'en' for English, 'de' for German) in my database. But I'm realizing that showing these in the UI is a whole different ball game—most users won't know that 'de' means Germany! I've looked into some APIs, but I'm not sure which ones are reliable. I'm considering creating my own API or container, but I thought I'd reach out to see what you all do for these common elements. Any tips or resources?
5 Answers
You're on the right track by using IDs internally! Just make sure to display readable names or icons in the UI. Users won't associate 'de' with Germany unless you give them extra context.
If you're sticking to ISO standards, there are tons of libraries and APIs available that can translate those IDs into user-friendly names and flags. For instance, I use flagcdn.com for icons—great for displaying country flags alongside their codes!
Don't forget that a simple Google search can point you towards a lot of useful resources!
If you're up for a bit of coding, you could write a JavaScript snippet to scrape country codes and names from Wikipedia and convert that into a CSV or JSON. Be careful with relying on AI like ChatGPT for names, though; it's likely to have inaccuracies that could trip you up later. You could also use simple scripts to scrape multiple pages for a comprehensive database of countries, currencies, and languages.
You can take advantage of various frameworks like Vue, React, or Angular. For each language, maintain a JSON file with tokens (like 'en' for English, 'de' for German) that correspond to the text you want to display. Additionally, the Intl interface in JavaScript is super helpful for localizing text, including country names, currencies, and dates.

Related Questions
How to Build a Custom GPT Journalist That Posts Directly to WordPress
Cloudflare Origin SSL Certificate Setup Guide
How To Effectively Monetize A Site With Ads