Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
EnzoC Posted May 4, 2018 Posted May 4, 2018 For the translation of these two sentences regarding the "%s" symbol:"Secondary groups changed to %s" and "Opt out from two factor authentication reset%s". In practice, in one sentence there is space with the symbol "%s", while in the other sentence the symbol is attached. Thank you have a nice day.
EnzoC Posted May 5, 2018 Author Posted May 5, 2018 Do not get crowded to answer all together, otherwise I do not understand anything!
steve00 Posted May 5, 2018 Posted May 5, 2018 35 minutes ago, EnzoC said: Do not get crowded to answer all together, otherwise I do not understand anything! Wow ... only waited 15 hours for reply Give people a chance to help ... be patient ... there are different time zones not just yours
Aiwa Posted May 5, 2018 Posted May 5, 2018 What are the keys from those strings? Look them up in the code and see where they are used? Test and see what values are driving the %s? You've impatiently waited 16 hours when you could have had the answer yourself in 10 minutes.
Daniel F Posted May 5, 2018 Posted May 5, 2018 Please see also https://invisioncommunity.com/4guides/themes-and-customizations/languages-and-localization_326/replacements-in-phrases-r122/
EnzoC Posted May 5, 2018 Author Posted May 5, 2018 23 minutes ago, Daniel F said: Please see also https://invisioncommunity.com/4guides/themes-and-customizations/languages-and-localization_326/replacements-in-phrases-r122/ Thanks Daniel to those who answered me. I saw your link, but I did not get an answer to my question, I do not see as an example the symbol %s attached to any word or name, maybe it's just my ignorance.
Daniel F Posted May 6, 2018 Posted May 6, 2018 Yea, unfortunately it's not possible to know what variable is used without looking into the template or php file where it is used.
EnzoC Posted May 6, 2018 Author Posted May 6, 2018 10 hours ago, Daniel F said: Yea, unfortunately it's not possible to know what variable is used without looking into the template or php file where it is used. Daniel, you could explain it to me also for the English language, it must also indicate something if the %s symbol is attached or spaced by a certain word. Good evening.
Aiwa Posted May 6, 2018 Posted May 6, 2018 %s is a special replacement character when using sprintf. To understand why there is or is not a space we'd have to know the exact language strings you're referring to and then look it up in the code to find out what values are being put in place of the %s during runtime.
opentype Posted May 6, 2018 Posted May 6, 2018 On 5/4/2018 at 11:52 PM, EnzoC said: In practice, in one sentence there is space with the symbol "%s", while in the other sentence the symbol is attached. There is no functional difference. It just depends on the output you want to get with that string later. If you want a space there, you add a space. If there should be no space, you don’t add a space. I think in the example you show the replacement for %s starts with a “:" or something like that, so it makes sense not put a space.
Meddysong Posted May 6, 2018 Posted May 6, 2018 When you translate a phrase, use the same approach. If the English version has a space, use it in the translation. If it doesn't, don't add one, or what appears on screen will look wrong.
EnzoC Posted May 6, 2018 Author Posted May 6, 2018 1 hour ago, Aiwa said: %s is a special replacement character when using sprintf. To understand why there is or is not a space we'd have to know the exact language strings you're referring to and then look it up in the code to find out what values are being put in place of the %s during runtime. Read the opening post of this topic and you'll understand what I'm looking for. 1 hour ago, opentype said: There is no functional difference. It just depends on the output you want to get with that string later. If you want a space there, you add a space. If there should be no space, you don’t add a space. I think in the example you show the replacement for %s starts with a “:" or something like that, so it makes sense not put a space. This is exactly what I'm looking for, to understand why the% s symbol is sometimes attached and sometimes there is a space. Example: My name is Enzo, so I could translate the phrase, "My name is %s", but if I write it, "My name is%s", it will become, "My name isEnzo", I hope I have been clear. You could give me an example, even in English to understand the difference, thanks. 38 minutes ago, Meddysong said: When you translate a phrase, use the same approach. If the English version has a space, use it in the translation. If it doesn't, don't add one, or what appears on screen will look wrong. So give me an example because I would like to understand.
opentype Posted May 6, 2018 Posted May 6, 2018 10 minutes ago, EnzoC said: So give me an example because I would like to understand. I gave you an example: If the replacement phrase starts with a colon. There is no space between the last word and the colon.
EnzoC Posted May 6, 2018 Author Posted May 6, 2018 24 minutes ago, opentype said: I gave you an example: If the replacement phrase starts with a colon. There is no space between the last word and the colon. Ok, I understand, we only hope that in Italian there will not be a chaos with the translation.
Aiwa Posted May 6, 2018 Posted May 6, 2018 1 hour ago, EnzoC said: Read the opening post of this topic and you'll understand what I'm looking for. Read all of my replies asking for more specific information and your argumentative responses with zero extra information. The English language is terribly inconsistent. If you want a general answer opentype gave it, but it likely won't apply in 100% of cases. If I/we can give you the tools to understand what's going on, you can figure out all the rest by yourself. Give a man a fish, he eats 1 meal. Teach a man to fish, he never goes hungry. Argue with the teacher and you starve.
EnzoC Posted May 6, 2018 Author Posted May 6, 2018 18 minutes ago, Aiwa said: Read all of my replies asking for more specific information and your argumentative responses with zero extra information. The English language is terribly inconsistent. If you want a general answer opentype gave it, but it likely won't apply in 100% of cases. If I/we can give you the tools to understand what's going on, you can figure out all the rest by yourself. Give a man a fish, he eats 1 meal. Teach a man to fish, he never goes hungry. Argue with the teacher and you starve. There are no fish, reeds or teachers. This discussion is becoming like a book and yet my question has been clear. I also wrote that I wanted an example, but all the answers were the same: "Put the symbol %s where it is", but nobody explains why, STOP.
Aiwa Posted May 7, 2018 Posted May 7, 2018 Your question is not clear, it is subjective. The content replacing the %s is done during runtime, E.G. Execution of the code. I'm trying to answer the why, but I need more specific information. Even DanielF said he would need more specifics of where the string is used to give further information. 17 hours ago, Daniel F said: unfortunately it's not possible to know what variable is used without looking into the template or php file where it is used. We need this information to teach you how to figure out the rest of these occurrences in the language pack, but you simply don't want to help yourself. If you want the WHY answered, but continue to not help yourself, good luck with your directionless topic.
EnzoC Posted May 7, 2018 Author Posted May 7, 2018 11 hours ago, Aiwa said: Your question is not clear, it is subjective. The content replacing the %s is done during runtime, E.G. Execution of the code. I'm trying to answer the why, but I need more specific information. Even DanielF said he would need more specifics of where the string is used to give further information. We need this information to teach you how to figure out the rest of these occurrences in the language pack, but you simply don't want to help yourself. If you want the WHY answered, but continue to not help yourself, good luck with your directionless topic. Listen well, my question is very clear, but you have not read carefully or do not want to understand. I have done at least 6 or 7 posts on the subject, but maybe or do not get there or mother nature has not given you the faculty to understand.
Aiwa Posted May 7, 2018 Posted May 7, 2018 1 hour ago, EnzoC said: Listen well, my question is very clear, but you have not read carefully or do not want to understand. I have done at least 6 or 7 posts on the subject, but maybe or do not get there or mother nature has not given you the faculty to understand. I see this exactly the opposite. It would take you 1 min to get and provide the language keys. Giving us a chance to get you an answer. Only then would you fully understand what it is we are TRYING to offer you. But instead you just want to waste your time with insults. If you respond to insults, it is infact you that does not have the faculties to understand the WHAT that is needed to answer the WHY to your question.
EnzoC Posted May 7, 2018 Author Posted May 7, 2018 3 hours ago, Aiwa said: I see this exactly the opposite. It would take you 1 min to get and provide the language keys. Giving us a chance to get you an answer. Only then would you fully understand what it is we are TRYING to offer you. But instead you just want to waste your time with insults. If you respond to insults, it is infact you that does not have the faculties to understand the WHAT that is needed to answer the WHY to your question. Other than insults, you have nothing to do with my discussion and I'm just wasting time with you. Next time, if you are able to respond, otherwise let it go, so we gain both time.
Aiwa Posted May 7, 2018 Posted May 7, 2018 Good luck. I'll put you on ignore so I don't have to deal with your ignorance again. I honestly hope you see the light at some point and can provide those trying to help you with the information they need to answer your questions.
EnzoC Posted May 7, 2018 Author Posted May 7, 2018 9 minutes ago, Aiwa said: Good luck. I'll put you on ignore so I don't have to deal with your ignorance again. I honestly hope you see the light at some point and can provide those trying to help you with the information they need to answer your questions. I sincerely hope that the light sees you, in this discussion you have shown the opposite.
Aiwa Posted May 7, 2018 Posted May 7, 2018 1 hour ago, EnzoC said: I sincerely hope that the light sees you, in this discussion you have shown the opposite. Seems to be your M.O. Out of morbid curiosity, I took a gander at your posts from the last week and you seem to like accusing pretty much everyone that they don't understand you, including many contributors that have been around for over a decade with post counts and positive reputation in the top 1% of this community. That was rather enlightening. Back to ignoring the Enzo channel. Up next, Trolls and how to avoid them.
EnzoC Posted May 8, 2018 Author Posted May 8, 2018 9 hours ago, Aiwa said: Seems to be your M.O. Out of morbid curiosity, I took a gander at your posts from the last week and you seem to like accusing pretty much everyone that they don't understand you, including many contributors that have been around for over a decade with post counts and positive reputation in the top 1% of this community. That was rather enlightening. Back to ignoring the Enzo channel. Up next, Trolls and how to avoid them. With this reply you have shown what I thought of you. In Italy we say that our grandparents have lived 100 years because they have always done their own business, see to do the same, in other situations I would have answered badly, but I am a polite person, but troll to your brother, not to subscribed and capit sarchiapò !!! This time I was clear and once and for all, if you can avoid responding to my posts, next time I will not be very polite, do you understand or do I have to explain it again?
Aiwa Posted May 8, 2018 Posted May 8, 2018 Since I'm a nice guy, I'll throw you a bone. There is a space there because the %s is an imploded array of secondary group names that is programmatically generated. // Creates an array of the new groups. $k = explode( ',', $jsonValue['data']['new'] ); /** * Format List * Takes an array and returns a string, appropriate for the language (e.g. "a, b and c") * * Relies on the _list_format_ language string which should be an example list of three items using the keys a, b and c. * Any can be capitalised to run ucfirst on that item * * Examples if $items = array( 'foo', 'bar', 'baz', 'moo' ); * If _list_format_ is this: Output will be this: * a, b and c foo, bar, baz and moo * A, B und C Foo, Bar, Baz und Moo * a; b; c. foo; bar; baz; moo. * * @param array $items The items for the list * @param string $format If provided, will override _list_format_ * @return string */ public function formatList( $items, $format=NULL ) //Formats that array into a string $new = \IPS\Member::loggedIn()->language()->formatList( $k ); return \IPS\Member::loggedIn()->language()->addToStack( 'history_group_legacy_mgroup_others', FALSE, array( 'htmlsprintf' => array( $new ) ) ); Secondary groups set to group1, group2, group3 (In English) For the latter. In the %s replacement, there is a space in front, even though it doesn't look like it in the AdminCP. <word key="history_by_admin" js="0"> by %s</word> <word key="history_by_member" js="0"> by member</word> $byMember = \IPS\Member::loggedIn()->language()->addToStack('history_by_member'); $byStaff = \IPS\Member::loggedIn()->language()->addToStack('history_by_admin', FALSE, array( 'sprintf' => array( \IPS\Member::load( $row['log_by'] )->name ) ) ); //Takes your language string and tacks on either ' by member' or ' by <admin name>' return \IPS\Member::loggedIn()->language()->addToStack( $jsonValue['optout'] ? 'history_mfa_optout' : 'history_mfa_optin', FALSE, array( 'sprintf' => array( $byMember ?: $byStaff ) ) ); So, you wanted an explanation of the difference... There you go. The replacement string for the former is a code generated list of values where adding the space would have to be manually done via the code. The latter is the insertion of yet another language string where the space can be added via the replacement string. It ultimately comes down to where IPS decides to squeeze the balloon, put it in the first string, or put it in the second string. Now, had you given me that information when I asked for it the first time, or even the second or third, this conversation would have gone a WHOLE lot smoother. But alas, you ignorance of why I asked for those details and your assumption that my questions where meaningless now shines bright. Good day.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.