8 kyu

Welcome!

24,201 of 52,970lucymonie

Description:

Your start-up's BA has told marketing that your website has a large audience in Scandinavia and surrounding countries. Marketing thinks it would be great to welcome visitors to the site in their own language. Luckily you already use an API that detects the user's location, so this is an easy win.

The Task

  • Think of a way to store the languages as a database. The languages are listed below so you can copy and paste!
  • Write a 'welcome' function that takes a parameter 'language', with a type String, and returns a greeting - if you have it in your database. It should default to English if the language is not in the database, or in the event of an invalid input.

The Database

Please modify this as appropriate for your language.

[ ("english", "Welcome")
, ("czech", "Vitejte")
, ("danish", "Velkomst")
, ("dutch", "Welkom")
, ("estonian", "Tere tulemast")
, ("finnish", "Tervetuloa")
, ("flemish", "Welgekomen")
, ("french", "Bienvenue")
, ("german", "Willkommen")
, ("irish", "Failte")
, ("italian", "Benvenuto")
, ("latvian", "Gaidits")
, ("lithuanian", "Laukiamas")
, ("polish", "Witamy")
, ("spanish", "Bienvenido")
, ("swedish", "Valkommen")
, ("welsh", "Croeso")
]

Possible invalid inputs include:

IP_ADDRESS_INVALID - not a valid ipv4 or ipv6 ip address
IP_ADDRESS_NOT_FOUND - ip address not in the database
IP_ADDRESS_REQUIRED - no ip address was supplied
Fundamentals

More By Author:

Check out these other kata created by lucymonie

Stats:

CreatedJul 8, 2016
PublishedJul 8, 2016
Warriors Trained93566
Total Skips8873
Total Code Submissions151983
Total Times Completed52970
JavaScript Completions24201
Ruby Completions1521
Python Completions17877
C# Completions2639
CoffeeScript Completions27
Java Completions4771
Elixir Completions305
C Completions664
Rust Completions1106
Scala Completions91
TypeScript Completions446
PHP Completions497
Haskell Completions71
Total Stars859
% of votes with a positive feedback rating89% of 5318
Total "Very Satisfied" Votes4345
Total "Somewhat Satisfied" Votes788
Total "Not Satisfied" Votes185
Ad
Contributors
  • lucymonie Avatar
  • jhoffner Avatar
  • Javatlacati Avatar
  • SagePtr Avatar
  • GiacomoSorbi Avatar
  • marcusaurelius Avatar
  • aryan-firouzian Avatar
  • 10XL Avatar
  • donaldsebleung Avatar
  • kazk Avatar
  • davejones Avatar
  • k.steflovic Avatar
  • rowcased Avatar
  • monadius Avatar
  • hobovsky Avatar
  • Mordna Avatar
  • Kacarott Avatar
  • KayleighWasTaken Avatar
  • Xwtek Avatar
Ad