in reply to Translation selection advise

But maybe it would be better to do it like this, as each phrase set would be together and cleaner code:

my $language = "de"; # ar, bs, de, en, es, fr, it, nl, pl, pt, ru, sk, sv, tet, tr, + uk, zh my %windTranslation = ( 'en' => "Wind:", 'de' => "Wind:", 'es' => "Viento:", 'fr' => "Vent:", 'nl' => "Wind:", ); my %humidityTranslation = ( 'en' => "Humidity:", 'de' => "Feuchtigkeit:", 'es' => "Humedad:", 'fr' => "Humidité:", 'nl' => "Vochtigheid:", ); my $windPhrase = $windTranslation{$language}; my $humidityPhrase = $humidityTranslation{$language};

Or is there maybe a better way, that I am not thinking of?

This is at least better than a huge bunch of if-then-else.

NetWallah++ is right, you better use a locale library.

BUT: If you really need just about 20 terms, a library might be overkill. Use a HoH instead:

my %translations=( en => { wind => 'wind', humidity => 'humidity' # ... }, de => { wind => 'Wind', humidity => 'Feuchtigkeit', # ... }, # ... ); print $translations{$language}->{'wind'},':';

Alternatively, you can use the terms as first-level keys and the language as second-level key:

my %translations=( wind => { en => 'wind', de => 'Wind', # ... }, humidity => { en => 'humidity', de => 'Feuchtigkeit', # ... }, # ... ); print $translations{'wind'}->{$language},':';

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)