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

Merged
merged 4 commits into from Jan 20, 2017

Projects

None yet

3 participants

@jegbagus

this commit related to ticket #82

include/api.php
+ * @param string $string the string to translate
+ * @return string translation in the current language
+ */
+function plll_esc_htlm__ ( $string ) {
@grappler
grappler Jan 11, 2017

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

@Chouby
Chouby Jan 16, 2017 Contributor

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

include/api.php
+ * @return string translation in the current language
+ */
+function plll_esc_htlm__ ( $string ) {
+ return esc_html__( pll__( $string ) );
@grappler
grappler Jan 11, 2017

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

include/api.php
+ * @param string $string the string to translate
+ * @return string translation in the current language
+ */
+function plll_esc_htlm__ ( $string ) {
@Chouby
Chouby Jan 16, 2017 Contributor

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

@grappler

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

@Chouby
Contributor
Chouby commented Jan 16, 2017 edited

Hi!

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

@jegbagus

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

include/api.php
+ * @param string $string the string to translate
+ * @return string translation in the current language
+ */
+function pll_esc_htlm__ ( $string ) {
@grappler
grappler Jan 17, 2017

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

include/api.php
+ echo pll_esc_htlm__( $string );
+}
+
+
@grappler
grappler Jan 17, 2017

There are two line breaks instead of one.

@grappler

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
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