<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">+1<div class=""><br class=""></div><div class="">While I think this could be an incredibly useful feature that would make teaching coding to people much easier since they no longer need to learn English words at all, I think this can get really tricky when you consider autocomplete and all of the work an IDE has to do to identify the language then get the localized string and suggest that to the user. The huge amounts of words/verbs/functions/variables that would have to be dynamically localized could really slow down an IDE. And Xcode already has a hard enough time handling everything right now...<div class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 24, 2017, at 12:33 PM, Jeff Kelley via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I think one of the easiest ways to do it would be to ensure that the actual .swift files are all using the root language of the framework—akin to the development region of an app. Using metadata the IDE would dynamically substitute the localized names, but the underlying file would use the canonical values. Trying to store the localized code in the files makes using version control across language borders impossible.<div class=""><br class=""></div><div class=""><br class=""><div class="">
<div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; line-height: normal; border-spacing: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Jeff Kelley</div><div class=""><br class=""></div><div class=""><a href="mailto:SlaunchaMan@gmail.com" class="">SlaunchaMan@gmail.com</a> | <a href="https://twitter.com/SlaunchaMan" class="">@SlaunchaMan</a> | <a href="http://jeffkelley.org/" class="">jeffkelley.org</a></div></div></span></div></div></div></div></div>
</div>
<br class=""><div class=""><blockquote type="cite" class=""><div class="">On Mar 24, 2017, at 2:03 PM, Joshua Alvarado <<a href="mailto:alvaradojoshua0@gmail.com" class="">alvaradojoshua0@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I wonder what it would do for reusability. It would be hard to share code between countries written in Spanish or japanense unless the compiler could convert the code to your language. Maybe properties and function calls could be converted over to different languages but I am not sure Swift keywords could be as easily converted which could lead to code with mixed languages due to languages not mapping 1 to 1 on every word. This would be really cool but a LOT of work. I think this is a bigger issue than just adding it into Swift. Taking a look at non-English-based programming languages - <a href="https://en.wikipedia.org/wiki/Non-English-based_programming_languages" class="">https://en.wikipedia.org/wiki/Non-English-based_programming_languages</a> - there are very few, if any, highly used languages on the list. Some languages implemented symbols instead of words so that it is not language based but that would cause breaking changes in Swift :)<div class=""><div class=""><br class=""></div><div class="">It would be cool to see code in different languages:</div><div class=""><br class=""></div><div class="">for i in foo {</div><div class=""> print(i)</div><div class="">}<br class=""><div class="gmail_extra"><br class=""></div><div class="gmail_extra">para i en foo {</div><div class="gmail_extra"> escribir(i)</div><div class="gmail_extra">}</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Mar 24, 2017 at 11:28 AM, Jeff Kelley via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div style="word-wrap:break-word" class=""><div class="">One of the things that struck me from today’s Apple press release about Swift Playgrounds being localized in more languages is this screenshot:</div><div class=""><br class=""></div><div class=""><span id="cid:4E5A7475-A760-469E-A915-125574AAC56B" class=""><cn_playgrounds_looping.jpeg></span></div><div class=""><br class=""></div><div class="">All of the UI is fully localized for Chinese, <i class="">except</i> the actual code. As far as I know, almost every major programming language and major platform framework is primarily English; it’s become the <i class="">de facto </i>language for developers. But does that have to be the case?</div><div class=""><br class=""></div><div class="">Imagine a world where alongside our Swift frameworks, we ship <font face="Menlo" class="">.strings</font> files that contain translations of our APIs to other languages. From some other screenshots we see that Swift Playgrounds is providing translations of method names to explain them, here providing “avanzar” for “<font face="Menlo" class="">moveForward()</font>”.</div><div class=""><br class=""></div><div class=""><span id="cid:9D276CBF-C25F-4942-A868-F0775B651711" class=""><sp_playgrounds_stepping.jpeg></span></div><div class=""><br class=""></div><div class="">A scenario where Swift supported localized frameworks might see a <font face="Menlo" class="">.strings</font> file with a format like this:</div><div class=""><br class=""></div><div class=""><font face="Menlo" class="">"moveForward()": "avanzar()"</font></div><div class=""><br class=""></div><div class="">Then, in Swift code, whether through an IDE, some metadata in a comment in the Swift file, or file extension (think “<font face="Menlo" class=""><a href="http://foo.es/" class="">Foo.es</a>.swift</font>”), a developer who selects Spanish could simply write <font face="Menlo" class="">avanzar()</font> and understand it in her native language. In fact, if the IDE is the layer that handles language selection, two developers who don’t even speak the same language could collaborate on code, and names from the framework would appear to each in their native language!</div><div class=""><br class=""></div><div class="">Comments and locally-defined names are of course still a barrier, but this isn’t new. I know that “mazu” means “first” in Japanese thanks to some code I worked on with an old coworker.</div><div class=""><br class=""></div><div class="">This is obviously out of scope for Swift 4, and would require significant effort to support, both technically in Swift itself and for those shipping Swift frameworks, both inside and outside of Apple, to provided localized names, so I wanted to throw this out to see if the community is even interested.</div><div class=""><br class=""></div><div class="">There’s just something about the idea of kids all over the world using Swift Playgrounds completely in their own language that makes me think this could help Swift achieve its stated goal of world dominance.</div><div class=""><br class=""></div><br class=""><div class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="font-family: helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="font-family: helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="font-family: helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="font-family: helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><span class="gmail-m_2944716445529640384Apple-style-span" style="border-collapse:separate;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;line-height:normal"><div style="word-wrap:break-word" class=""><div class="">Jeff Kelley</div><div class=""><br class=""></div><div class=""><a href="mailto:SlaunchaMan@gmail.com" class="">SlaunchaMan@gmail.com</a> | <a href="https://twitter.com/SlaunchaMan" class="">@<wbr class="">SlaunchaMan</a> | <a href="http://jeffkelley.org/" class="">jeffkelley.org</a></div></div></span></div></div></div></div></div>
</div>
<br class=""></div></div><br class="">______________________________<wbr class="">_________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a><br class="">
<br class=""></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature">Joshua Alvarado<div class=""><a href="mailto:alvaradojoshua0@gmail.com" class="">alvaradojoshua0@gmail.com</a></div></div>
</div></div></div></div>
</div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></div></div></body></html>