Originally published on meridianbuild.dev, my build log for OutfitMaker, an AI outfit planner that works from the clothes you already own.

OutfitMaker suggests outfits from the clothes you already own, and the weather is part of the suggestion. On the home screen, the calendar and the suggestion page, there is a small line with the temperature and the sky: "12° · Overcast Clouds".

The app is in five languages: English, French, Spanish, German and Portuguese. Every member saw that line in English. A French member got a page entirely in French, then "Overcast Clouds" in the middle of it, with a capital C that English doesn't even use.

The fix looked like one line. It wasn't, and the reason is the useful part of this post.

The one line fix

The weather comes from OpenWeather. The description ("overcast clouds", "light rain", "few clouds") is whatever the API sends back, and OpenWeather has a lang parameter that returns the description in the user's language. Pass the member's locale, get French instead of "overcast clouds", done.

Before adding it, I searched the code for everything that reads that description. Here is what came back.

The string was data, not a label

The coat rule, in the outfit suggestion service:

COAT_WEATHER = /rain|drizzle|storm|shower|snow|sleet/i 

and later:

@weather[:condition].to_s.match?(COAT_WEATHER) 

The day ahead forecast, in the weather service, decides if rain is expected the same way:

rainy: conditions.any? { |c| c.match?(/rain|drizzle|storm|shower/i) }, 

The weather push notification matches the condition against /rain|snow|thunder|storm|drizzle|sleet|hail/i to decide whether there is anything to warn about. The prompt sent to the model includes the condition as text: [Weather: 12°C, overcast clouds - ...]. The MCP tools that let an AI assistant read your outfit of the day write it into their answer: "Weather in Lyon: 12°C, overcast clouds."

So the English description was not a label. It was an input to at least four pieces of logic, and three of them match English words with a regex.

Now imagine the lang parameter in place. A French member in the rain gets a description with "pluie" in it. /rain|drizzle|storm|shower|snow|sleet/i does not match "pluie". No coat rule, no "rain expected" in the forecast, no rain alert. Nothing crashes. Nothing logs an error. The suggestions just get a little worse for everyone who is not reading in English, and I would have found out from a member wearing a light jacket in a storm, if ever.

And the cache would have mixed languages

There was a second trap, one level down. The current conditions are cached per place:

cache_key = "weather:#{normalized_location}" 

The key has the location and nothing else. With lang on the request, the first member to ask for Paris would decide the language of Paris for everyone until the cache expired. A German member in Paris would get French. An English member would get French, and their coat rule would be off too.

That one is fixable with a locale in the key, but it would also mean one API call per city and per language instead of one per city. For a label.

Translate where it is shown, nowhere else

The rule I ended up with: the value fetched, cached, stored and read by the logic stays exactly what the API sends, in English. Only the label shown to the member goes through a translation, at display time. PR #313 (commit be2835c) adds a small helper:

module WeatherHelper WEATHER_CONDITIONS_SCOPE = "weather.conditions".freeze def weather_condition_label(condition) text = condition.to_s.strip return "" if text.empty? key = text.downcase.gsub(/[^a-z0-9]+/, "_").gsub(/\A_+|_+\z/, "") label = I18n.t(key, scope: WEATHER_CONDITIONS_SCOPE, default: nil) if key.present? label = text unless label.is_a?(String) && label.present? label.upcase_first end end 

"overcast clouds" becomes the key overcast_clouds, which is "Ciel couvert" in French and "Bedeckt" in German. A description I have no entry for is shown as received, so a new value from the API degrades to English instead of a missing translation marker. nil and blank give an empty string instead of raising in the middle of a page.

The five views that printed the raw string now call the helper. Two of them also had titleize or a CSS capitalize class, which is where "Overcast Clouds" with two capitals came from. Those are gone: the casing rule is now an initial capital only, in every language, English included.

Covering the whole list, and keeping it covered

OpenWeather publishes its list of descriptions, grouped by condition code from 2xx (thunderstorm) to 8xx (clouds). There are 55 of them. Each of the five locale files has those 55 keys, plus unknown, which is the value my own weather service uses when the API sends no description.

Translations are the kind of thing that rots quietly, so the PR adds a test file for the locale files themselves:

  • the five files have exactly the same keys;
  • the keys are exactly the 55 official descriptions plus unknown;
  • every label is a non empty string of 40 characters or less, starting with a capital;
  • the English label is the API description itself, with only the first letter capitalized.

The first one is the one that matters most. A key missing in one language does not raise anything, it silently shows English for that one condition, in that one language. Nobody would report "drizzle rain is in English in Portuguese". The test will.

There are also integration tests that render the home page, the calendar and the suggestion form in French and in English and check the label, including one that makes sure a calendar entry's stored English forecast is translated on screen and left untouched in the database. A helper test covers the edge cases: unknown description, nil, blank, odd casing and spacing.

What this did not fix

The weather push notification still builds its message from the English condition. This PR was about what is printed on the pages, and the notification text needs its own pass. I'd rather say that here than pretend the app is fully translated.

I also have no metric for this. Nobody wrote in about "Overcast Clouds". It is a small thing that makes a French page look like a French page, and the reason it took a helper and three test files instead of one parameter is the part I wanted to write down.

The takeaway

Before you translate a string that comes from an API, search for everything that reads it. If any of it is logic, a regex, a comparison, a prompt, a cache key, the string is data, and data should not change language. Translate the label at the last possible moment, in the view, and keep one canonical value everywhere else.

One of the readers of that string is the MCP server I wrote about last week. An assistant asking for today's outfit gets the weather in the same English words the coat rule reads, which is exactly what I want: one value, read the same way everywhere.