Quantcast
Channel: polylang – WordPress.org Forums
Viewing all 11471 articles
Browse latest View live

golbarg on "[Plugin: Polylang] CPT archive navigation language switcher"

$
0
0

Hi,

I have a CPT and am using the archive pages for them, and there seems to be a problem with the navigation language switcher.

When I am in /fr/my-fr, the link is /en/my-fr instead of /en/my-en

I have defined the slugs in the CPT with:

if(get_locale() == 'fr_FR')
{
$args = array(
    'rewrite' => array('slug' => 'my-fr'),
    // more
);
}
else
{
$args = array(
    'rewrite' => array('slug' => 'my-en'),
    // more
);
}
register_post_type( 'my-cpt' , $args );

I have tried using "Polylang - Translate URL Rewrite Slugs" plugin in combination with Polylang, using the following piece:

add_filter('pll_translated_post_type_rewrite_slugs', function($post_type_translated_slugs) {
    // Add translation for "my-cpt" post type.
    $post_type_translated_slugs = array(
        'my-cpt' => array(
            'fr' => array(
                'has_archive' => true,
                'rewrite' => array(
                    'slug' => 'my-fr',
                ),
            ),
            'en' => array(
                'has_archive' => true,
                'rewrite' => array(
                    'slug' => 'my-en',
                ),
            ),
        ),
    );
    return $post_type_translated_slugs;
});

With this I get the right URLs for:
/en/my-en/cpt-post-en
/fr/my-fr/cpt-post-fr

However, when I'm on the archive page (/en/my-en), the link to the other language is missing the language (/my-fr instead of /fr/my-fr) and returns a 404.

I have also tried using

add_filter('pll_get_post_types', 'my_pll_get_post_types');
function my_pll_get_post_types($types) {
	return array_merge($types, array('my-cpt' => 'my-cpt'));
}

I can't seem to find a way to make this work as it should, and I did try flushing the permalinks.

Any help?

PLL 1.6
(PLL-TURS 0.3.1)
WP 4.0

https://wordpress.org/plugins/polylang/


golbarg on "[Plugin: Polylang] CPT archive navigation language switcher"

$
0
0

Permalinks:
/%category%/%postname%/

Reading:
Home page static, article page undefined.

PLL:
Default lang is fr
Language determined by directory (/en/my-post/)
NO hiding of default language
Delete '/language/'
Home page is language instead of page name
NO language detection
NO media handling
All CPTs checked
NO sync options checked

ypp on "[Plugin: Polylang] Catch Everest homepage not translating"

$
0
0

Thank you very much, Chrystl!

Changing to 'The language is set from the directory name in pretty permalinks' in URL modifications has got the homepage translating correctly. Much appreciated!

RedCenso on "Polylang with Super5 theme => menu"

$
0
0

Hello,

The Super5 theme doesn't work with polyland
The menu doesn't change with another language

I found the code but I don't know how change it (i want to keep class and ID)

Code in a standard theme :

<nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation">
				<button class="menu-toggle"><?php _e( 'Primary Menu', 'twentyfourteen' ); ?></button>
				<a href="#content"><?php _e( 'Skip to content', 'twentyfourteen' ); ?></a>
				<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
			</nav>

In my theme I have :

<?php if (has_nav_menu('main-menu')) : ?>
                    <?php wp_nav_menu(array('container_class'=>'snavigation col-md-12 hidden-sm hidden-xs', 'container'=>'nav', 'items-wrap'=>'<ul id="%1$s" class="%2$s">%3$s'.kioken_topSearch().'')); ?>
                <?php else: ?>
                    <nav class="snavigation  col-md-12 hidden-sm hidden-xs">

<ul>
<li><a>"><?php echo __('No Menu Exists! Create Menus Here',K_THEME_NAME); ?></a></li>
</ul>
                    </nav>
                <?php endif; ?>

Could you help ?

https://wordpress.org/plugins/polylang/

Steve2222 on "[Plugin: Polylang] Prepopulate title/text/custom fields of new translated page"

$
0
0

Hi Chouby,
Great plugin, and very intuitive to use!

I wondered if you have considered prepopulating new translated pages, i.e. when I click on the "Add new translation" plus sign, the title, text and custom fields would already be prepopulated with the contents of the default/previous language, as a reminder of what needs to be said in the newly created page... The Page Attributes (Parent, Template) are already prepopulated, which is very convenient!
All this could also be an optional Setting.

https://wordpress.org/plugins/polylang/

Steve2222 on "[Plugin: Polylang] Deactivate translation for media: language attribute stays"

$
0
0

I just noticed that when I uncheck "Activate languages and translations for media" this does not remove the language attributes that were previously assigned to media items while this was still checked. So the previously uploaded media items keep their language attribute and continue to not be available throughout all languages. In addition, unchecking this setting removes the language switch, locking the media items to their previously selected language.

I might be missing something -- I haven't used polylang for very long at all -- but I thought disabling languages for media should also remove the language attributes from existing media. Thoughts?

https://wordpress.org/plugins/polylang/

Chouby on "[Plugin: Polylang] Custom flag in svg format"

Chouby on "[Plugin: Polylang] [Request] Back-end flag for greenlandic (kl_KA)"

$
0
0

Hi!

To create the list of builtin languages, I initially looked at the WP 3.1 translations (first version supported by Polylang). Now I add languages supported in WP languages packs or contributed Polylang translations.

However here is how to solve your problem.

Create a directory wp-content/polylang, add your flag file in this directory and name it kl_KA.png since you chose kl_KA as locale for your language. Polylang will use this flag on frontend.

It won't use it on backend because people may use big custom flags and there is a risk to get an ugly result on backend side.

So you will need to put some php code to achieve your goal:
Create a file wp-content/polylang/pll-config.php and put this in it:

<?php
add_filter('pll_get_flag', 'pll_get_flag', 10, 2);
function pll_get_flag($html, $slug) {
	global $polylang;

	if ('kl' == $slug) {
		$lang = $polylang->get_language($slug);

		if (file_exists(PLL_LOCAL_DIR.($file = '/'.$lang->locale.'.png')) || file_exists(PLL_LOCAL_DIR.($file = '/'.$lang->locale.'.jpg')) )
			$url = PLL_LOCAL_URL.$file;

		$html =	sprintf(
			'<img src="%s" title="%s" alt="%s" />',
			$url,
			esc_attr(apply_filters('pll_flag_title', $lang->name, $lang->slug, $lang->locale)),
			esc_attr($lang->name)
		);
	}
	return $html;
}

Edit: you need Polylang 1.6


Chouby on "[Plugin: Polylang] Display languages that are being used in theme options plugin"

Chouby on "[Plugin: Polylang] dropdown menu not working"

$
0
0

A dropdown does not take any action. The widget includes the javascript code to direct you to the translated page. The function 'pll_the_languages' does not include any javascript code because it is intended for developpers who want to customize the language switcher. You need to copy the javascript from the widget if you want the dropdown to do the same thing as in the widget.

Note: You should remove <ul> statement if you use pll_the_languages to output a dropdown. This is needed only when it outputs a list.

hnkim0602 on "[Plugin: Polylang] Korean language error"

$
0
0

Hello.

I use front page and making multi language pages.
so far I have English, Deutsch which doesn't have any problem.
but when I added Korean it says I need to install language manually.
so I downloaded Ko_KR.mo file and uploaded to wp-content/language/
and published page and Korean menu.

but when I scroll down the menu doesn't appears and also contact page doesn't appear as well..

http://www.manwerbe.at/wordpress/

could you please help

https://wordpress.org/plugins/polylang/

Hermelijn on "[Plugin: Polylang] Custom flag in svg format"

$
0
0

Chrystl, thx, but exactly there it says you have to use either .png of .jpg

Hermelijn on "[Plugin: Polylang] Custom flag in svg format"

$
0
0

Thank you Chouby, my php knowledge is growing by the day but is not yet so good I can follow up on your answer. But I'm happy because now I know there is a way to do this.
I believe, with more and more high res screens, more developers will have a need for this.
So I'll study and see if I can code this.

Meanwhile, if there's anybody out there who already did, I'd be grateful if he posted it. :-)

Chouby on "[Plugin: Polylang] Korean language error"

$
0
0

Hi!

I visited your website and see no issue on the Korean menu and contact form (except that the contact form is not translated yet).

hnkim0602 on "[Plugin: Polylang] Korean language error"

$
0
0

Hi Chouby !
I solved problem.

it was the language's name.
when I added Korean to polylang its name was '한국어' which its own letter.
WP doesn't recognise it.

so I changed language name '한국어' to 'Korean'
and now it works perfectly.

I tried Japanese as well. 日本語.
if you want to use Japanese, you need to change its name when you install(add) language.

Thank you.


Ron Rennick on "[Plugin: WordPress MU Domain Mapping] Domain mapping with translation plugins"

$
0
0

Maybe an other sollution? In the blog settings for example?

You could write a plugin to do that. Domain mapping is in process of being added to WP core. We are not adding an new features to the plugin.

Suiram on "[Plugin: Foodlist] Polylang incompatibility"

$
0
0

Hi!
It seems your great plugin (v1.9.1 installed), has some incompatibility with another plugin I love: polylang (https://wordpress.org/plugins/polylang/) installed version: v1.6.

The simptoms are:
1.- Foodlist Settings page yells two warnings:
Warning: Missing argument 2 for PLL_Plugins_Compat::cft_copy() in C:\xampp\htdocs\montbell\wp-content\plugins\polylang\include\plugins-compat.php on line 129

Warning: Missing argument 2 for PLL_Admin_Sync::add_meta_boxes() in C:\xampp\htdocs\montbell\wp-content\plugins\polylang\admin\admin-sync.php on line 48

(And the worst...)
2.- Menuitem tags doesn't works: on menuitem creation or edition, it is not possible to add a tag, as it returns 'No matches found' and doesn't let me assign any.
And what's more: any previously assigned tag (while polylang is deactivated) disappears on polylang activation.

Let me know if I can help you in any way.

Thanks in advance!
J

https://wordpress.org/plugins/foodlist/

Aurovrata Venet on "[Plugin: Media Library Assistant] Multi-language WPML/Polyland plugin support"

$
0
0

Dear David

Some observations about PolyLang wrt MLA:

Is translation enabled for media?
PolyLang allows the user to switch off the translation for media (a checkbox in the plugin settings page).
- you can verify if this is the case with the polylang function,
pll_is_translated_post_type('attachment')

- if media is not translated, then MLA needs to do nothing further.

What happens when PolyLang translates media?

- When a media file is translated in PolyLang, it duplicates the existing attachment post, allowing for the attachment title/alt text/caption/description to be translated. However, both are pointing to exactly the same media file.

- the duplicate post is now associated with the original attachment post by inserting a new unique term to the post_translations taxonomy in the wordpress table,
wp_insert_term($uniqueID_as_term, 'post_translations', array('description' => serialize(array( 'en'=>'<postID_en_trans>','jp'=>'postID_jp_trans' )) )
Note how it makes use of the description field of the new term to store the serialised array containing the translation mapping.

- it also register the above 2 post with the corresponding unique term,

wp_set_object_terms(<postID_en_trans>, $uniqueID_as_term,'post_translations');

The MLA plugin can reproduce all of the above by simply making a call on the API function pll_save_post_translations($arr) (see doc) to save the twined 'attachment' posts, by building the following array $arr:

//let's say $def_post_id is the media attachment post ID we want to translate
// first we check if there is already a translation
$trans_post_id = pll_get_post($def_post_id, $trans_lang);
// if $trans_post_id=null MLA duplicates the original post for user selected language $trans_lang slug (eg 'jp')
$trans_post_id =... //duplicate attachment post id.
$def_lang = pll_get_post_language($def_post_id,'slug');
$arr = array( $def_lang => $def_post_id,
              $trans_lang => $trans_post_id);
pll_save_post_translations($arr);
//polylang plugin will merge the new translated key with existing translations, so we don't need to worry about passing the previous translations)

So MLA can pretty much do what it does so far, with the exception of adding a dropdown 'language' menu in the Quick-Edit box, and saving bulk media meta data set for selected language in the $trans_post_id attachment post, where each one is twined with its original language using the above piece of code.
If for a given language there is already a post for that media, then the post needs to be updated rather than created.

A list of languages can be obtained for the menu by calling the PolyLand function pll_languages_list(array('slug','name'));.

Translating MLA Att.Category
PolyLang allows for plugins to register strings to translate using the API function pll_register_string($pluginName, $string), so we could also look at allowing for the translation of media taxonomies. This would require the additional association of translated taxonomies with their default language (like the media post above), but it would also necessitate the association of translated media attachment post with its corresponding translated taxonomy.

I would suggest that we leave this for another day, and set if we can get the MLA to manage translated media post for now.

Your thoughts?

kind regards

Vrata

Suiram on "[Plugin: Foodlist] Polylang incompatibility"

$
0
0

Uhm... hello again! :)
I'm trying a couple of things: when using polylang user can determine which custom post types are translated.
If I uncheck the 'Tag' taxonomy on polylang configuration, voilà! tag labels appear on menuitem.

So, it works, but with that unchecked automatic translation on language switch doesn't work, as it does for menuitems and menus :(

michaelpon12 on "[Plugin: Polylang] dropdown menu not working"

$
0
0

i already fix the problem by creating another widget area and using the widget language switcher. much easier for me to do that using the javascript since Im not familiar with that. thanks btw.

Viewing all 11471 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>