Skip to content

Custom language var#15

Open
luileito wants to merge 2 commits intomaximeschoeni:masterfrom
luileito:custom-language-var
Open

Custom language var#15
luileito wants to merge 2 commits intomaximeschoeni:masterfrom
luileito:custom-language-var

Conversation

@luileito
Copy link
Copy Markdown

@luileito luileito commented Jan 9, 2017

This PR makes the language_query_var property name configurable. This way e.g. if my blog is already using lng=fr to translate contents, now I can indicate Sublanguage to use the lng as well (instead of the default language name).

See https://wordpress.org/support/topic/customize-query-var-name/

@maximeschoeni
Copy link
Copy Markdown
Owner

maximeschoeni commented Jan 9, 2017

Hello,
I think most users won't need to change this and adding an option for this make things look more complex... What about solving this issue by a simple hook, like this:

add_action('sublanguage_admin_init', function($sublanguage) {
  $sublanguage->language_query_var = 'lng'; // or whatever
});

... And by adding this hook in the admin.php file in init():

do_action('sublanguage_admin_init', $this);

Anyway, I think I hard-coded the language query vars in some places, so even if we make changes it won't work correctly, I need to check the code...

@luileito
Copy link
Copy Markdown
Author

Hey, thanks for looking into this. I didn't know of the hook-based approach, maybe it's worth trying though with this PR the plugin is now behaving exactly as I wanted to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants