 Så. Ja, vi har det problem. Or, vi hade problem. And we will walk through it together. So what press celebrates 20 years? We made the special nice site. We translated this site. We beat 20 to 29 under half languages. The half language is Arabic, but I mean. De probably didn't have time to do all of it. And then it suddenly occurred in the meter channel. That the Japanese site is down, but only the Japanese site. To me, that is a clear sign that this is probably something about internationalization or and or localization, because otherwise not only one single language would be hit. So I will call this the Japanese enigma. This problem will follow us today. We will think a little bit about it, but in the meantime, I will give you some good hints about the biggest problems you can try to avoid as a developer. When you are writing code for plugins and themes to make sure that it will be possible to translate these to all these 70 different languages that we maintain. I mean, I think this is great as a developer. You can write code. You do it all in English. Perhaps, you know, Dutch or Finnish and you make your own translation. That's fine. But then you have all these volunteers, people who use your code. And think that I really think that this plugin should be available in Greek so they can do it for you. That's great, right? So yeah, this is how you write my strange name Torbjörn Fjellner. I'm Swedish. I live in Barcelona since 11 years, but I left Sweden before that I have worked in various countries in the Middle East in Russia. I'm fluent in Russian as well. And yeah, I have a question. Who in this room don't speak English as your native language? OK, and who here has English as their native language? Oh, OK, so this pretty much matches what we have in the world, right? 5 % of the world's population speak English as their native language. Then there is another 10, give or take, percent who know English, but it's not their native language. And the question for you as a developer or plugin owner is, are you developing for the whole world or only for the blue areas, right? And the situation with WordPress itself echoes this somewhat. We had a cutover point in 2017, six years ago, where at one day we suddenly noticed that, hey, more than half of all WordPress sites that we know of, all the WordPress sites that are constantly pinging us and asking if there are any updates to go and get, are using other languages than US English. OK, some of these translated versions are translated into British English and so on, but still technically speaking, they are of course also translations, but we are still on the safe side, even if we talk just about English, because now we are at 56 % translated sites and it's continuing to grow slowly, but steadily. And this means that I would have the right to name this talk in a slightly different way, but I didn't do that because then we would have needed more seats in this room because it would be too clickbaity if we would say, do internationalization, write and double the reach of your code, right? OK, so I'm going to use the word internationalization a lot, but you can write it I18N and those figures just means that we have deleted 18 letters in this long word and then we can still fit it into a slide. Yeah, so the agenda for today, I'm going to show you the iceberg of the most important things the developer can do to make it easier to translate your plugin or theme. And in parallel, we will also solve this Japanese enigma that we just heard about. So let's first have a look at where the problem was. So it was in this string here in the source string. It reads the translation for this local is incomplete. Stop help us get to 100 % word written by contributing a translation. And this last part is clickable. You've got some nice HTML. This screenshot I took from another language, Persian for Afghanistan, and it hasn't been translated yet, but you can still see the funny thing that it is a right to left language. So of course the cursor is blinking to the right, but this is PowerPoint. PowerPoint doesn't blink, but you can still get the idea. And now let's talk at the top five things. Also here, if you already know what the problem is, please, I think it's best if you keep track quiet for two reasons. First of all, let your neighbors also try to figure, because this is like a little thing to. It's nice if you manage to figure it out before everyone spells it out in real time, and also if you right now, already shout out what the problem is, then I will nominate you to be the next global mentor for polyglots. So number five, two long strings. As in if you put in the string, the whole body of an email that explains the full process, and it is like one page and a half, or if you have several paragraphs, this will, well, it is possible to do and we do it, of course, but it's hard to translate in our user interface, because the translator or if I'm the translation reviewer, I need to see the source segment. I need to see the translation segment and I need to see some references and some comments, and even with my 17 inch screen, that gets tricky. Right? So it's hard to translate. It's hard to review. And it gets really hard to fix so-called fuzzy matches. A fuzzy match is when the translation memory has a translation since before of a string that is very close to what we have now. Perhaps just one letter is capitalized or there is a dot at the end. Ja, ja, your left to right, that will be here. Ja, a dot at the end that has been added or removed, and that is technically speaking a different string and it needs to be checked. And if you need to compare a long source string that is like half a page long and figure out what has changed, can I still use this translation or do I need to change anything, it's not easy. And also, of course, the sad thing about if I have spent 15 minutes on translating this huge email and I get credited for only one string. That's not nice, right? So that was two long strings. Now number four, two short strings. So if here I'm thinking about like just one or two words, a good word that we could see here could be like clear cash. Ja, det är en action, och det är något som är bra, men stort. Så, post, ja, post är min favorit. Men det kommer, jag har, på nästa slag har jag något om det, så jag var försöker hitta nåt annat. I the talk we had yesterday, the workshop, they said lead is such a dangerous word because you don't know if you can have a lead that you connect your dog to and then you go for a walk or you can have a lead for your hand when you are walking down the staircase or you can have leads when you are trying to sell something that is a possible future customer. In this case, or also another thing, let's say the string is just a capital letter T. Then you start looking into the code and you see that. Oh yes, that could be Tuesday or it could be Thursday, right? Or something else, I don't know. So if in this case with post or where it's just a letter T or a letter S, which could be Saturday or Sunday. You really should use underscore X in get text. We use the source string itself as the database key to find the right translation. But if you use the underscore X, then you add a couple of more. One word may be enough just to clarify the context. And then it is a part of the translation key. So still don't put a lot of explanations that you should put in a translation comment before. And then you have this thing that will just indicate where this should go. And the number three, too short. We had that, didn't we? Right? So this is a different case. Two short strings in the meaning that you should not use short strings that you try to build together programmatically. You know, they say they have a string nu. And then where you find it's new and the space. And then there is another string somewhere else that says post. And then suddenly realize that oh, there was a space before that word post or page or something. And then programmatically, they are combining this into these wonderful phrases that work perfectly fine in English. But in Swedish the word nu needs to be translated in different ways, depending on whether it's a new page or a new post. Or if it is plural, I mean, new pages. That's a different word for nu. Right? And it's the same in many languages and you are European. You know this. I mean, if you speak Spanish or French or something else, then this comes quite naturally. But for those of you who watch this live streamed in the US, there are languages out there that don't combine in exactly the same way and in exactly the same order that you do in English. And this is important to keep in mind. So you need to build. Complete decent sentences, and if you need to put some variable inside this, yeah, you need to use printf or something like that. And don't be afraid of including an HTML tag. I mean, the polyglots team has seen those before and we don't get too scared of them. And, yeah, grammatical congruence, word order, all these things are things that can mess things up if you don't think carefully. And also include punctuation marks in your strings. Don't add them separately. In just the same reason that you shouldn't use CSS code that enforce capitalization, because capitalization differs between languages. Or well, if you have a question mark at the end, nice, but in Spanish, we need to put an inverted question mark before the question. Or in French, you need to put a space before some punctuation marks. Right? I mean, a colon cannot just be a colon. Of course, you need to have a non-breaking space before. I mean, you know that, right? So, next thing is not really an error, but something that can be made much better, being reachable. So, you have made a wonderful plugin and then there are some internationalisation hiccups that the translators find. And they would love to help you, because when we help you, you help us. Right? I mean, if you make a string translatable, then I can translate it better. And you can do this in various ways. The easiest way that is already there is, of course, that if you have a plugin or a theme in the repository, then you can receive input that way. So, I have written several posts in specific plugin and theme forums, where I say, dear developer, here is a thing that really would be good if you could fix. And that means that keep an eye on your forum, because there may be useful stuff there now and then. If you outsource your support handling, remind them that if they see this kind of bug reports that they really should not be afraid of forwarding it to you. But there are more ways you can do. I guess most of the people here are already on site, but if you are not, bring up your phone, activate your QR scanner, and go and register in Slack. And then in your readme, add a comment that bug reports are welcome via Slack. That's great. I mean, you can get very quick connections there. I guess most of the people here are already on Slack, but if you are not, bring up your phone, and you can get very quick connections there. So, while you scan that, I will have a sip of water. Okay, done. If you are using GitHub for your development, then by all means, link to your GitHub project in your readme, because then we will happily, some of us at least, go and open an issue for you. And some more brave polyglots would even drop a pull request. That means that you can get some of your internationalization errors fixed just by accepting them. Nice, right? And then there is one more thing. We are experimenting with feedback directly inside the translation platform. Still a little bit unstable in terms of, yeah, the platform itself works, but I have a feeling that now and then messages don't get through all the way. If you would like to dive into this a little bit, then grab your phone again and take this. Or the smart thing you can do is, I will give you a link later on so you can download the whole presentation. And I will not redact these QR codes. They will be there. Yeah, and this bigger QR code is for this longer URL. Okay, if I go, any problems if I go to the next slide? Okay, so it's time for the next clue in our Japanese enigma. So this is how this source string was translated into Japanese. I'm not going to pronounce this. I don't speak Japanese. But one funny thing we can see is, of course, that I talked about punctuation marks and you see that Japanese doesn't use normal dots. They have small circles instead. I think it's really nice and beautiful, but it's also a clear sign that things happen in a different way. So, yeah. Any problem if we go further and we go to number one in our list of things that bothers me as a translator? Okay, go ahead. Or if you are asleep, then that's fine too, but I think we should be fine. So the big problem that we see all the time, every, no, not every, but a lot of young smart developers are just like me lazy people. And they like wonderful efficient shortcuts. And then at some point when they program and they write code and they feel the poetry of this code. And then they realize that, oh, I have this case here where I need to write something if it is singular. That means one piece. Or else if it is more than one. I saw a case a few months ago where they had something for WooCommerce where if there was more than one article, then they should indicate how many articles and how much was each article in price. And then the rule would give the total to the right or to the left but there is a problem with that. This command underscore N is a great tool when used correctly and for the right thing. So the purpose of underscore N is to make it possible to linguistically correctly translate strings that include a number. That include a number. So the value N that you use to steer whether it should be singular or plural must be a part of that string. You can see an example here. How it would work nicely. So this is a correctly written thing. Of course you would need to escape somewhere later on but I'm skipping that part right now because you know that better than I do. And since N must be a part of this string this means that you have to use printf statement or something similar. It also means that you have to include this variable N twice first as a parameter to underscore N to select which form we should use whether it should be singular and plural. Actually that's what I'm coming to now. It's not about singular and plural. This is about getting the right form. And in many languages we have three different forms or less or more. And then of course you need to have N also as a value for insertion via the printf statement. So here is where it looks right now. I mean Swedish just like English we have singular for one and we have plural for everything else be it zero or be it 25 or something else. Those of you who know French know that there is already a small difference between French and English and that is for zero. In English you would say zero umbrellas in French. They use the singular form for zero. So it's slightly different but still very much the same and it would work nicely in most of these cases. But when we come to Japanese for instance if the number is a part of the string nothing in other places of the string will change depending on which number we had. Which means that you don't have any singular or plural it's just one string. So this pair of strings in the source string will get only one single translation for Japanese. In Japanese you can give a generic plural it's possible. Just if you have a number then you wouldn't do it. And therefore those strings would need to be two separate strings and you would need to use your own program to specify which of these cases you have if it is a table heading or something. And here is the... This is the evidence right? In Arabic every occurrence of underscore n needs to be translated six times. Zero is one case, one another two a third case three for five, next one and then if it's eleven, twelve and thirteen and something then you have a lot... next to us and then the last case is if it's 100 or more then it's the six. So they have six even the fingers on one hand doesn't fit for this. Right? So again remember and tell your co-developers that if you are using underscore n then n must be a part of the string which means you need to use printf and you need to insert this variable twice in your code. And it's time for enigma. So we will have some intense waiting time where you try to figure this out and I will now give you the last clue on this again. Once more. So this is how it was translated and we will count downwards five, four, three, two, one zero, here we go. So the problem here is and how many people guessed this before I showed this? Yeah, that's great. It took me some time also. Somebody else found this out before I did because in all this Japanese I just got stuck but it's good. We have some people here. So this percent sign here of course since it will be put inside the printf statement it needs to be escaped. So how could we fix this various ways and suggestions? Yeah, so one way would have been of course on the translation level you can fix this by just setting a double percent sign or you could change it to just write percent as a word like they had in the source string or actually the funny and very strange way they actually solved it in this case they changed it to a different percent sign. Well, it looks exactly the same but the double byte character, right? So the developer here they could of course have been smart they could have written something that didn't use the percent but just say fully translated and this would never have happened or they could have written percent with the double percent sign in the source then no translators would have missed this or if they would have missed it they would quickly have realized what the problem was. That was the enigma and we are about to finalize here so we should summarize and I've got two minutes left so I will try to speak... We will manage. So the international they internationalization details to remember avoid two long strings avoid two short strings don't try to combine or build sentences or words out of short strings and be reachable for feedback and make sure that you include the value of N in your string if you are using the underscore N statement. That was just the tip of the iceberg. There is more. I have a quite long explanation and I will be happy for feedback on how I can make it better how I can cover things that I have not mentioned there yet. If you go to my site there you will also be able to find the download. It should be published 12 minutes ago but the first guy who gets there will just trigger the cron so the second guy will get the download. Ja, so that's what I mean if you do internationalization right then you can double the reach of your code because you make it available for all the world and most of all I would say that this also has a deeper meaning when it comes to the mission of WordPress we say democratize publishing and one very important aspect of democratizing publishing is of course to enable it to all those 85% of the world who don't know English. Thank you. Now we have some time for Q&A we have two microphones set up one on either side in both aisles so come on down throw some elbows if someone is in your way and ask away I got a shy crowd You need to walk down there and ask a question I guess I think we've got a taker I've got some Hello, my name is Luigi I'm from Italy I would like to ask you something about I don't know if this is the right context but recently we are using more and more the internationalization module in our scripts and everything is fine as long as we use the script translations which loads the JSON translation rather than the traditional PEO MO translation files what we are finding a little difficult is when we need to use dynamically loaded scripts like lazy loading scripts from for example React so we don't want to load all our components because that will impact the performance of the website so we are forced to lazy loading some components and even though we are trying to follow the instruction from for example automatic jetpack is doing that and is giving some sort of instruction we believe that we follow what they are doing but still when some components are lazy loaded rather than loaded from the page load the translation file doesn't get picked up and we find it very difficult for us because our customers always complain oh these strings cannot be translated we are trying to translate it but we don't manage to translate it yeah I have a very easy answer to this, I'm not the right person you could try to reach out to Swisspidi because he was one of the key developers of this functionality I don't know exactly which part of the slack would be the right place to ask about this but probably core internationalization would be a suitable channel where you can find the right people to ask this of course I mean if you have internationalization questions anything except this then by all means feel welcome to come to our slack channel Polyglots and ask there I mean since we are a truly global team there are almost always some experienced people around and they will be able to give you much better answers than your traditional rubber duck who is otherwise helping you with your travel shooting for these props I need to give props to youth because it's theirs I will need to give it back to their fishing pulled afterwards I hope I want something with my question yeah okay thank you okay I have a question I guess while people are getting that courage to go to the microphone I was just kind of wondering what you thought about google translate like are you able to use the right or any other tool like deep hole or smart cat oh yes it's exploding right now with a lot of different machine translation solutions and it's a great tool it speeds up the translation process and the AI things give us every week slightly better quality but I would say that as a developer or plugin owner or something never try even don't try to publish translations that were just machine translated but not checked by a human because you will get incorrect terminology you will get awkward things that just don't fit right it always needs this last human touch so the translation can go quicker we will be able to reuse previous translations from the translation memory more and more but we have that is one of our biggest tools that don't just blindly approve unchecked machine translation so very good question thank you thank you for a nice presentation and I would just like to comment this live translation feature that is introduced for the plugins because as you mentioned for slavic languages the order of the words in the sentence is different so now when you load the plugin and works on the plugin live you can see how often the word is in the wrong place and this thing with like one has one form and then two to five two to four has another form and then five on has third form and this is where you often case with slavic languages since you know Russian you probably know how that goes that was more of the commendation for this live feature but I have a question are you a ham radio operator yeah you may have me in your logs if you were active in the second half of the 80s Sierra Mike Zero Roma Yankee Bravo I haven't been on for ages for me amateur radio was very much about the combination of technology and communication and guess what the internet came around right hello thank you for the talk more than a question I have another pitfall that I would like to tell some plugin developers to be aware of is that do not do not assume the length of a string do not make like that is a very good thing in your layout first of all have someone you always can go and ask about did we do it right when it comes to right to left languages because we mess it up all the time and the other thing is yes leave at least 50% perhaps even try that if something is double the length will it totally break my sight or will it just nicely wrap to a new line inside and everything will just adjust that is a very good comment thank you yeah well we started with you and we should try to do it quickly here thank you for the great talk thank you you mentioned do you think it's okay for like putting HTML in the strings to be translated I was just wondering how you handle things like escaping like for example if you use escape HTML on a string and it has a link in it obviously that will strip the link out what sort of approaches do you take yeah that's a very good thing so if you need to put some weird things inside the string and you know that you need to escape it later on the best thing you can do is to use a printf statement and you just include it by a variable and then you make sure that you escape everything else and then you put it together right so that's one way you can do it escape it in the right place and then insert what you need to insert or sometimes you can just try to fine tune how you escape and what you escape but all these long escaping functions for translations is your final protection against evil translations so it's very good to have them and always have them because sometimes translations may come from unexpected places and you don't want that to be what breaks your site or your users site somewhere else hi thanks for the presentation what is your opinion on translating some things which are very technical or are meant for developers like for example Paken or API response that don't mean maybe there are better examples but that are meant for developers and maybe if you translate them to a local language the developer who is going to probably see this won't understand me so there are a lot of developers who barely know English Back in the school many many years ago I did some schoolwork about computers and this was like when computers weren't really a thing yet so yeah I was a nerd I guess because I read this full book about machine code for the microprocessor Zilog Z80 and my English teacher was like wow were able to read that and I didn't tell her the truth that you know this specific language is just a different way of coding stuff and it just happens to be kind of English but I mean I managed to understand it because it's very simple language but yes it can be useful I would say in instructions around how to use an API but I would never dare to translate the API parameters or something like that because then it will just break things I guess I don't know if I answered your question or some other question but not the code parameters but some technical real words but technical but there are plugins for all kinds of people there are plugins that are aimed at developers by all means make them translatable that's nice and polyglots we have tens of thousands of polyglots contributing some of them are very technical and then of course vast majority well not very technical and this is their way of contributing still but you translate those strings that you feel that you understand and you can handle and if you feel a bit unsure then you ask someone else to come and have a look that I translated it right or what kind of terminology should we use here so it's still doable and as a developer yes by all means make it possible right thank you now you're going to cut me off right I will cut you off yeah but let's give another round of applause for Tobi thank you here's a little gift from thank you so much come on keep it going guys