Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to escape string for translation in the string translation panel #83

Merged
merged 4 commits into from
Jan 20, 2017

Conversation

jegbagus
Copy link

this commit related to ticket #82

* @return string translation in the current language
*/
function plll_esc_htlm__ ( $string ) {
return esc_html__( pll__( $string ) );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing the text domain here. You want to do return esc_html( pll__( $string ) );.

* @param string $string the string to translate
* @return string translation in the current language
*/
function plll_esc_htlm__ ( $string ) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a "l" too many in plll and html is spelled incorectly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please rename the function to pll_esc_html__ including in the function where it is used below?

* @param string $string the string to translate
* @return string translation in the current language
*/
function plll_esc_htlm__ ( $string ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please rename the function to pll_esc_html__ including in the function where it is used below?

@grappler
Copy link

pll_esc_attr_e() & pll_esc_attr__() should be included too if pll_esc_html__() is going to added.

@Chouby
Copy link
Contributor

Chouby commented Jan 16, 2017

Hi!

I am ok to introduce these new functions. We could also add the corresponding functions for esc_attr()

@jegbagus
Copy link
Author

hi @grappler thank you for correction. Also add pll_esc_attr (without _e and ). WordPress it self not having esc_attr or esc_attr_e function. so i think we don't need to have it also.

Thank you

* @param string $string the string to translate
* @return string translation in the current language
*/
function pll_esc_htlm__ ( $string ) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a space between the function name and the opening bracket. HTML has still a typo.

echo pll_esc_htlm__( $string );
}


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two line breaks instead of one.

@grappler
Copy link

WordPress it self not having esc_attr or esc_attr_e function

I am not sure what you mean. You can see these two function below.
https://developer.wordpress.org/reference/functions/esc_attr_e/
https://developer.wordpress.org/reference/functions/esc_attr__/

@Chouby Chouby merged commit 25bf1df into polylang:master Jan 20, 2017
Chouby added a commit that referenced this pull request Jan 20, 2017
@Chouby
Copy link
Contributor

Chouby commented Jan 20, 2017

I renamed pll_esc_attr() to pll_esc_attr__() to follow the same pattern as similar functions. I also added pll_esc_attr_e()

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.

3 participants