local t = {}
local love = love

t._languages = {
  "en",
  "test",
}

t._fonts = {
  default = love.graphics.newFont( 18 )
}

local fallbackString = function( t, s )
  return "!:"..tostring( s )
end

function t._setLanguage( name )
  local lang = name or "en"
  local strings = require( "i18n."..lang )
  local fontName = rawget( strings, "_font" ) or "default"
  setmetatable( t, {__index =
      setmetatable( strings, {__index =
          fallbackString } ) } )
  if t._fonts[fontName] then love.graphics.setFont( t._fonts[fontName], 22 )
  else t._fonts[fontName] = love.graphics.setNewFont( fontName, 22 ) end
  return t
end

return t._setLanguage( "en" )