public function format($format)
    {
        if (!is_string($format)) {
            throw new InvalidArgumentException(sprintf(
                'format passed must be a string'
            ));
        }

        $translateNext = false;
        $escNext = false;
        $formatted = '';
        foreach (str_split($format) as $char) {
            if ($escNext) {
                $formatted .= $char;
                $escNext = false;
                continue;
            }

            if ($translateNext) {
                switch ($char) {
                    case 'c':
                        $translated = strtolower($this->getCountryCode());
                        break;
                    case 'C':
                        $translated = strtoupper($this->getCountryCode());
                        break;
                    case 'l':
                        $translated = strtolower($this->getLanguageCode());
                        break;
                    case 'L':
                        $translated = strtoupper($this->getLanguageCode());
                        break;
                    default:
                        throw new InvalidArgumentException(sprintf(
                            'Unkown format'
                        ));
                }

                $formatted .= $translated;
                $translateNext = false;
                continue;
            }

            if ('\\' == $char) {
                $escNext = true;
                continue;
            } elseif ('%' == $char) {
                $translateNext = true;
                continue;
            }

            $formatted .= $char;
        }

        return $formatted;
    }