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

Translation #974

Closed
filipw-trafikbyran opened this issue May 14, 2019 · 18 comments · Fixed by #1303
Closed

Translation #974

filipw-trafikbyran opened this issue May 14, 2019 · 18 comments · Fixed by #1303

Comments

@filipw-trafikbyran
Copy link

Problem:

Some Woocommerce strings in ex the cart don't translate to Swedish as the rest of the shop does.

Suggestion:

I have seen a lot of others haveing simalar problems to me. That Understarp tries to translate Woocommerce string with it's own translations files instead of the Woocommerce translationsfiles for strings that are not changed from the woocommerce templates other than some classes and colors. Wouldn't it be better to just use the Woocommerce translations? For example in the SE translation file these string don't exist and it would be a hassle to keep them updated anyway since it would just be copy paste from the woocommerce templates.

EX:

Row 95 to 98 in cart.php in understrap :
<td class="product-price" data-title="<?php esc_attr_e( 'Price', 'understrap' ); ?>"> <?php echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key ); // PHPCS: XSS ok. ?> </td>

Row 95 to 98 in cart.php in woocommerce templates:
<td class="product-price" data-title="<?php esc_attr_e( 'Price', 'woocommerce' ); ?>"> <?php echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key ); // PHPCS: XSS ok. ?> </td>

there is other cahnges made to this file, that's why it exist, but i don't see the reason for using the understrap translations over the woocommerce once.

So i suggest that Woocommerce translations are to be used in all of the woocommerce files

@0dp
Copy link
Collaborator

0dp commented May 28, 2019

@understrap/translation-team

@Thomas-A-Reinert
Copy link
Contributor

Bouncing that issue. I really support @filipw-trafikbyran ´s suggestion. Keep WooCommerce translation strings to woo and do not overwrite them with understrap translations. That´s been an issue to my own implementations also.

@understrap/woocommerce-team whaya saying?

@0dp
Copy link
Collaborator

0dp commented Jun 8, 2019

As i remember it off the top of my head, we can't do that because the theme won't get accepted by the WordPress theme review team

@pattonwebz
Copy link
Contributor

Having more than 1 text domain inside of a single theme causes issues when it comes to auto-distributed language packs for themes that are available from the .org servers. When I say it causes issues I mean it might just break it completely lol

In the past it couldn't handle multiple text-domains at all - however that may have changed and is worth investigation if anyone has time.

Due to the limitations on the language pack distribution system the Theme Review Team recommendation has been: you should have 1 text-domain used through the entire theme.

Themes can make use of a 2nd text domain if they want to but it breaks the ability for .org server to correctly send translations for the theme if any exist. In many cases that's not a problem because themes aren't always translated - but this theme does have translations available here: https://translate.wordpress.org/projects/wp-themes/understrap/

@0dp
Copy link
Collaborator

0dp commented Jun 10, 2019

As this topic comes up again and again.

We should probably start researching and coming up with ideas to address this as @pattonwebz suggest

@MarieComet
Copy link
Contributor

Hi !

it seems that templates are overloaded especially to add markup (buttons, row, cols).
Two ideas:

  • styling the buttons using the WooCommerce classes instead of adding the Understrap classes (.btn)
  • use WooCommerce actions when possible instead of duplicating templates (add_action)
    This way there would be fewer strings to translate with Understrap, and fewer templates to update when WooCommerce is updated.

For example for buttons .btn, .btn-outline-primary which are added to all woocommerce buttons (.button) and .btn, .btn-primary which are added to all woocommerce submit buttons, we can do something like this :

.woocommerce .button {
	@extend .btn, .btn-outline-primary;
}
.woocommerce input[type=submit] {
	@extend .btn, .btn-primary;
}

@Thomas-A-Reinert
Copy link
Contributor

Hey Marie!

Seems like a really good idea to me in general, @MarieComet - but that doesn´t solve the translation issue or did I get something wrong?

Or could we get rid of some templates completely by just adding that tiny piece of code? To be verbose: are some templates just there to add some button-styles and none else at all?

@MarieComet
Copy link
Contributor

Hey

That should solve the translation issue if WooCommerce templates are not overriden by the theme, because strings will not be overriden by Understrap textdomain anymore, so no need to translate and update them.

And yes, there is a lot of templates overriden by Undestrap "just" to add some button CSS classes.
That's a common and easy solution, but this requires regular follow-up to keep up with WooCommerce updates + duplicate string translations in themes.

@MarieComet
Copy link
Contributor

If I found some times for that I will test the idea above (CSS instead of markup in template), and see how many templates can be deleted from Understrap.

@Thomas-A-Reinert
Copy link
Contributor

Sidenote: Personally I erase all that WooCommerce-stuff from Understrap by now. I just override/inject styles with custom functions/actions/hooks That may be not very intuitive, but according to my experience, works best.

@Thomas-A-Reinert
Copy link
Contributor

Any sincere solutions to it that would benefit all both lang-domains? There MUST be one, or WP is lacking a solution for plugins.. But that´s my opinion

Trying to bounce that issue with my comment ;)

@fero8
Copy link

fero8 commented Mar 4, 2020

Isn't it possible just to copy the Woocommerce mo/po files to understrap and not bother with the translation at all? Understrap does not change any of the strings, just adds proper Bootstrap markup, right? So, does translating Woocommerce default strings here actually make sense:
https://translate.wordpress.org/projects/wp-themes/understrap/

Or am I missing something?

@Thomas-A-Reinert
Copy link
Contributor

Where is the benefit over copying/including the default strings under the "woocommerce" domain into a theme domain ("understrap") which is not allowed anyway, if i´m not all wrong.

If you "copy" them with a theme update, they will get overwritten anyway.

@fero8
Copy link

fero8 commented Mar 14, 2020

Well, it would mean that all the strings that have alreadt been translated within woocommerce would not have to be translated again by the child theme or understrap just because the domain had been changed.

I am not an expert Wordpress / WPML translator, but there does not seem to be an option to display already translated string from one translation domain (i.e. woocommerce) for exactly the same string in another domain (i.e. understrap or child-theme).

@Thomas-A-Reinert
Copy link
Contributor

Well, yes this has been a problem from past to present. Can´t tell anymore what was causing it though. As far as I recall, on WP.org there cannot be any themes submitted with two language domains. I may be wrong, never personally contributed to WP.og.

I´d try to reach @UnderstrapFramework if I was you and ask what´s the case with that. Maybe he, the repo owner, can shed some light?

@danemorgan
Copy link
Contributor

I just checked and word from the theme review team is that while the automated tests will throw a warning about multiple language domains, it's only a warning, and using more than one is allowed in repository themes.

So when I start updating Woocommerce ( after Bootstrap 5 ), I'll both look for opportunities to switch away from template use and move all woocommerce translation strings to their domain.

@danemorgan
Copy link
Contributor

Of course, if anyone else has a burning desire to take this one, jump in! But I think some templates only exist for bootstrap classes and I'm not sure how that will change in the update to 5.

@danemorgan danemorgan linked a pull request Jul 2, 2021 that will close this issue
9 tasks
@danemorgan danemorgan added this to the 1.0.0 milestone Jul 2, 2021
@danemorgan danemorgan added this to TESTING in Understrap RoadMap Jul 2, 2021
@bacoords bacoords moved this from TESTING to DONE in Understrap RoadMap Aug 25, 2021
@bacoords
Copy link
Member

bacoords commented Sep 8, 2021

Closing with the launch of 1.0.0.

@bacoords bacoords closed this as completed Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment