I got a YAML file with the following structure containing country names in German:
countries:
country_1: "Schweiz"
country_2: "Deutschland"
country_3: "Italien"
country_4: "Frankreich"
country_6: "Afghanistan"
I can import the file to Ruby and save it as a Hash
.
require 'yaml'
yml = YAML.load_file('countries.yml')
countries = yml['countries']
I want to translate them into French. I thought that this should be a fairly simple task using I18nCountryTranslations
, but I'm stuck. Is there a way to do this with built-in Ruby tools? Or do I need the whole Rails framework for this? Or an external API?