kcpau Posted August 10, 2016 Share Posted August 10, 2016 In the blockcart module translation there is this string : There are [1]%d[/1] items in your cart. The Simplified Chinese translation that comes with the system only has %d without the [1]..[/1]. As a result, when there are two or more items in the cart, the Simplified Chinese version shows 0 items. When I added back the [1]..[/1], the display is correct. I could not find the [1]..[/1] notation mentioned in any documentation. I thought the %d is sufficient. Can someone tell me what they are for? Link to comment Share on other sites More sharing options...
rocky Posted August 11, 2016 Share Posted August 11, 2016 There are instructions at the top of the page when editing translations in the Back Office: Some of these expressions use this special syntax: %d.You MUST use this syntax in your translations. Here are several examples "There are %d products": "%d" will be replaced by a number. "List of pages in %s": "%s" will be replaced by a string. "Feature: %1$s (%2$d values)": The numbers enable you to reorder the variables when necessary. Link to comment Share on other sites More sharing options...
kcpau Posted August 11, 2016 Author Share Posted August 11, 2016 But the [1]..[/1] notation is not described in the instruction. is [1]%d[/1] the same as %1$d? If that is the case, the string There are [1]%d[/1] items in your cart. only has one value to substitute, why does it need to have the position specified?? Thanks Link to comment Share on other sites More sharing options...
rocky Posted August 11, 2016 Share Posted August 11, 2016 I have no idea. I've never heard of that notation before. You can remove it and just use %d. Link to comment Share on other sites More sharing options...
eleazar Posted August 11, 2016 Share Posted August 11, 2016 I have no idea. I've never heard of that notation before. You can remove it and just use %d.I'm afraid, no, you cannot! If you remove it, the variable won't be replaced - lIke in the wrong Chinese translation the user mentioned. It indicates a tag, often replaced by a link, and you have to keep it. For more informations please have a look at the Crowdin translators instructions. Link to comment Share on other sites More sharing options...
rocky Posted August 11, 2016 Share Posted August 11, 2016 Oh, I see. I'm not familiar with Crowdin. It must be different. Link to comment Share on other sites More sharing options...
kcpau Posted August 11, 2016 Author Share Posted August 11, 2016 Thank you. I am still not very clear how a tag is used. But I know to keep them in the string. Link to comment Share on other sites More sharing options...
eleazar Posted August 11, 2016 Share Posted August 11, 2016 Just another example without a numeric placeholder: Please make sure you\'ve chosen a [1]payment method[/1] and accepted the [2]terms and conditions[/2]. At runtime this will be replaced for the customer with links to the payment methods' page or the terms of trade. Other examples: Not you? [1]Log out[/1] You can also [1]download your invoice[/1] To disable it, go to[1]Product Settings[/1] Hopefully it becomes clearer now for you. However, the questioned translation item seems to be outdated in any case. The current wording is: There are %products_count% items in your cart. The PrestaShop developers are unbeatable in creating new translation items with every new release. Link to comment Share on other sites More sharing options...
kcpau Posted September 24, 2016 Author Share Posted September 24, 2016 Thanks Link to comment Share on other sites More sharing options...
Krystian Podemski Posted September 26, 2016 Share Posted September 26, 2016 In 1.6 you can use "tags" like this: {l s='Hello [1]Guest[/1], [2]login[/2] please' tags=['<strong>', '<a href="#">']} this would be converted into: Hello <strong>Guest</strong>, <a href="#">login</a> please 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now