I need missed languages to be displayed on the Blog page. I have 4 languages (german, czech, english, french), so when i have english post with german translation, I need to show that there is no translation in czech and french, and that english and german are ok. I've found that in admin I have column "Languages" with similar information on All posts page and I found the code for it
function qtranxf_languageColumn($column) {
global $q_config, $post;
if ($column == 'language') {
$missing_languages = null;
$available_languages = qtranxf_getAvailableLanguages($post->post_content);
if($available_languages === FALSE){
echo _x('Languages are not set', 'Appears in the column "Languages" on post listing pages, when content has no language tags yet.', 'qtranslate');
}else{
$missing_languages = array_diff($q_config['enabled_languages'], $available_languages);
$available_languages_name = array();
$language_names = null;
foreach($available_languages as $language) {
if(isset($q_config['language_name'][$language])){
$language_name = $q_config['language_name'][$language];
}else{
if(!$language_names) $language_names = qtranxf_default_language_name();
$language_name = isset($language_names[$language]) ? $language_names[$language] : __('Unknown Language', 'qtranslate');
$language_name .= ' ('.__('Not enabled', 'qtranslate').')';
}
$available_languages_name[] = $language_name;
}
$available_languages_names = join(', ', $available_languages_name);
echo apply_filters('qtranslate_available_languages_names',$available_languages_names);
}
do_action('qtranslate_languageColumn', $available_languages, $missing_languages);
}
return $column;
}
but i don't know how to fix it by my needs please help me with this question!
you should do something like this: (in your theme single.php or entry-content.php)
// get the post id
$post = get_post();
$post_id = $post -> ID;
// check if en is available and the current language not english
if(!qtranxf_isAvailableIn($post_id, 'en') && qtranxf_getLanguage() != 'en'){ // no En content
echo 'no english';
}
// check if the french is available and the current language not french
if(!qtranxf_isAvailableIn($post_id, 'fr') && qtranxf_getLanguage() != 'fr'){ // no FR content
echo 'no french';
}
// check if the czech is available and the current language not czech
if(!qtranxf_isAvailableIn($post_id, 'cz') && qtranxf_getLanguage() != 'cz'){ // no cz content
echo 'no czech';
}
// check if the german is available and the current language not german
if(!qtranxf_isAvailableIn($post_id, 'de') && qtranxf_getLanguage() != 'de'){ // no Ger content
echo 'no german';
}
Not Tested Code
that might help or lead you to find a working solution.