Suggested or locative case for location name

This topic contains 8 replies, has 3 voices, and was last updated by  Alexander Krutov 4 years, 2 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #531724

    Alexander Krutov
    Expired Member
    Post count: 652

    Good afternoon!
    For a more beautiful display of the site in Russian and Ukrainian, I would like to have the location names in the locative case. They should be displayed in the title of the search page and archive. Is it possible?

    #531745

    Alex Rollin
    Moderator
    Post count: 27815

    Can you give us an example page URL and a screenshot to show what you want to change?

    You are talking about switching this based on the WPML language?

    #531751

    Alexander Krutov
    Expired Member
    Post count: 652
    This reply has been marked as private.
    #531755

    Alex Rollin
    Moderator
    Post count: 27815

    There is no current facility for that, but I will share your topic with the developers in case they have some advice for you.

    #531776

    Alexander Krutov
    Expired Member
    Post count: 652

    Thanks!

    #531915

    Kiran
    Moderator
    Post count: 7069

    Hi Alexander,

    The things you asked is not easily feasible, because to show some string in different languages first it requires that string translated in all languages. But currently there is no way to store all locations in different languages.

    If there are very limited strings then it can be done via title filter.

    Regards,
    Kiran

    #531921

    Alexander Krutov
    Expired Member
    Post count: 652

    Good afternoon, Kiran!
    Could you show me how to use a title filter for this task?

    #531926

    Kiran
    Moderator
    Post count: 7069

    Hi,

    Here is filters that contains all the location variables replaced in title. https://github.com/AyeCode/geodirectory/blob/f86727454bf051dd220864ba9fbe9987a95a6a9c/includes/location-functions.php#L404

    Example for в Львів:
    1) Add following in geodirectory/language.php

    __( 'в Львів', 'geodirectory' );

    2) Re-scan geodirectory plugin po file
    3) Translate в Львів in different language
    4) Add following snippet

    
    
    function gd_snippet_filter_location_replace_variables( $replace_vars, $locations = array(), $sep = NULL, $gd_page = '' ) {
    	if ( ! empty( $replace_vars['%%location_single%%'] ) ) {
    		$location_single = __( $replace_vars['%%location_single%%'], 'geodirectory' );
    
    		$replace_vars['%%location_single%%'] = $location_single;
    		$replace_vars['%%in_location_single%%'] = wp_sprintf( _x( 'in %s','in location', 'geodirectory' ), $location_single );
    	}
    	return $replace_vars;
    }
    add_filter( 'geodir_filter_location_replace_variables', 'gd_snippet_filter_location_replace_variables', 20, 4 );

    Thanks,
    Kiran

    #531943

    Alexander Krutov
    Expired Member
    Post count: 652

    It’s very difficult for me. Okay, I’ll use what I have.

Viewing 9 posts - 1 through 9 (of 9 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket