I would like to generate a list of available languages for a blog.
I’m building a multilingual template that several blogs could use.
Each blog could have a specific set of available languages.
As I don’t want the template to hold any blog specific information, the only place to set the list of available languages for a blog is in its path.php as a global variable.
"available_languages" => 'en, fr, es',
Clicking any language link from the list would switch the page’s language, for any template, this requires the URI of the new language page to be generated dynamically.
So it seems that the only way to have such list is to use a plugin similar to List Maker
But by list I mean that for each language something will be output, I don’t want the plugin to add more than what is wrapped in its tags.
The plugin would fetch the list from the specified variable in the specified file and for each language it would output the HTML wrapped inside its tags.
EE tags an other path.php global variable would also need to be wrapped in to generate the URI.
Or the plugin to be wrapped in EE tags, I don’t know.
Example :
{exp:global_variable_list_maker global_variable_file_path="/home/web/ee/path.php" global_variable="available_languages"}
<li>
{exp:weblog:entries weblog="{x_blog_short_name}" limit="1"}
<a href="{title_permalink="post"}{global_variable}/" rel="alternate" hreflang="{global_variable}" title="<!-- language's full name -->">
<img src="{x_ee_directory}images/languages/{global_variable}.gif" alt="{global_variable}" height="20" />
</a>
{/exp:weblog:entries}
</li>
{/exp:global_variable_list_maker}
Ideally the language’s full name should also be displayed - I don’t know the best way to do this.
Anyone interested ?
