I am using codeigniter and the language is determine by the session.
I wrrite the meta data, facebook / twitter grab the data and share the page:
echo "<meta name='twitter:card' content='summary' />";
echo "<meta property='og:title' content='" . $video->{set_lang("title")} . "' />";
echo "<meta property='og:description' content='" . $video->{set_lang("description")} . "' />";
echo "<meta property='og:image' content='" . (isset($video->image_url) ? site_url("thumbnail/" . $video->image_url) : $video->thumbnail) . "' />";
The set_lang function is to check the session like this:
function set_lang($var) {
$CI = & get_instance();
$lang = $CI->session->userdata('site_lang');
if ($lang == "english") {
return $var;
} else if ($lang == "zh_tw") {
return $var . "_tw";
} else if ($lang == "zh_cn") {
return $var . "_cn";
}
}
The share function work fine in the browser, however, I would like to share the link by mobile app too. Since the app contain no session it can not check language. Also, if I put the parameter in the link, eg.
http://example.com/video/view/1/english
Then my share link will also fix the language.
Any ideas ? Thanks a lot for helping.
Have you explored the internationalization documentation?
Using og:locale:alternate
meta tags (one pointing to each language) should show the link in the Facebook users native language across Facebook.com.
Try it out :D
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With