Swift Programming in Japanese
This post is blog version of my talk on try! Swift Tokyo 2025. video link: https://www.youtube.com/watch?v=uVgxJpSvp-I Intro Programming has a history of over 50 years. Historicaly, source code has been written in English. Thanks to Unicode, modern programming languages support writing source code in natural languages other than English. Swift is a modern programming language that was launched 10 years ago. I tried Swift programming in Japanese. Based on my experience in developing this app App name: PlainShogi Board game app. It was released 3 years ago and has been updated continuously. Developed it using a standard setup: Xcode, Swift, and SwiftUI. By leveraging SwiftUI, I actively supported multiple platforms. What's Shogi? A traditional Japanese strategy board game. Played on a 9x9 board with unique piece movement rules. Known as “Japanese chess”. There are eight types of pieces in Shogi. enum Piece: String { case 歩, 角, 飛, 香, 桂, 銀, 金, 王 } This is the code of pieces. Swift allows you to use Japanese for identifiers. That’s pretty nice. I wrote the source code in Japanese so the pieces can be displayed as is on the UI. No additional code is required. I actively considered these approaches for this app. And I challenged myself to write almost all of the source code in Japanese. In this post, I would like to write based on the experience. What's “Swift programming in Japanese”? Swift source files are encoded in UTF-8. Swift is designed to allow non-English identifiers. Reserved words and framework identifiers remain in English. Using Japanese for naming identifiers. In this post, we will call this “Swift programming in Japanese”. Premise of this post Mac Xcode Swift Apple’s development tools and frameworks only No special tools and configs Based on my personal experience Out of Scope for This Post Advantages and disadvantages of non-English speakers using their native language for programming. Whether non-English speakers should program in English. Feasibility of Japanese identifiers Consider whether the character can be used as an identifier. Invalid characters Xcode will display an error message for invalid characters. It will also fail to compile. Let's examine characters by category. Hiragana Hiragana is the most basic character of the Japanese language. Counting by Unicode standards, there are 80 characters. All are valid. Katakana Katakana is similar in usage to italic fonts in English. There are 81 characters. All are valid. Kanji Kanji is Chinese characters adopted into Japanese writing system. In Japan, about 3000 kanji characters are used. All are valid. Symbol In Japan, these symbols are used. There are 32 symbols. With regard to symbols, there are characters that can be used and characters that cannot be used. Invalid Japanese symbols 13 invalid characters Comma and Period Brackets Symbols written at the beginning or end of a sentence These are generally unnecessary for identifiers Combining characters Unicode has a special type of characters. These are combining characters. Combining characters decorates one other character to create one new character. In Japanese, there are combining characters for the voiced and semi-voiced marks. These are valid. Alphabet Many Japanese do not speak English, but they use the alphabet. It is used in combination with other character types. Of course, the alphabet can be used as an identifier. Arabic numerals Arabic numerals are used in the same way. Of course, they can be used as identifiers. All Japanese characters These are all commonly used Japanese characters. However, there are many more characters in Unicode. If the number of characters that are actually used infrequently is included, the number is about twice as large. In total, there are over 6500 characters. Almost all Japanese characters are valid. Invalid characters are only some symbols. Does Swift compiler build properly? Here are some concerns that come to mind. Are there any bugs? Does it behave differently from English? Is there any performance loss? No problem at all. Does Xcode work properly? Here are some concerns that come to mind. Does it work as a text editor for Japanese in the first place? Will suggestions and other features work smoothly? Will Japanese fonts display properly? It is common to use identifiers as file names. Is it okay to use Japanese file names? Is Git built in to Xcode also okay? All of these are fine. Everything works properly. Test on Xcode XCTest requires identifiers to begin with “test”. This is a little disappointing. This has recently been

This post is blog version of my talk on try! Swift Tokyo 2025.
video link: https://www.youtube.com/watch?v=uVgxJpSvp-I
Intro
- Programming has a history of over 50 years.
- Historicaly, source code has been written in English.
- Thanks to Unicode, modern programming languages support writing source code in natural languages other than English.
- Swift is a modern programming language that was launched 10 years ago.
- I tried Swift programming in Japanese.
Based on my experience in developing this app
App name: PlainShogi
- Board game app.
- It was released 3 years ago and has been updated continuously.
- Developed it using a standard setup: Xcode, Swift, and SwiftUI.
By leveraging SwiftUI, I actively supported multiple platforms.
What's Shogi?
- A traditional Japanese strategy board game.
- Played on a 9x9 board with unique piece movement rules.
- Known as “Japanese chess”.
There are eight types of pieces in Shogi.
enum Piece: String {
case 歩,
角,
飛,
香,
桂,
銀,
金,
王
}
This is the code of pieces.
Swift allows you to use Japanese for identifiers. That’s pretty nice.
I wrote the source code in Japanese so the pieces can be displayed as is on the UI. No additional code is required.
I actively considered these approaches for this app.
And I challenged myself to write almost all of the source code in Japanese.
In this post, I would like to write based on the experience.
What's “Swift programming in Japanese”?
- Swift source files are encoded in UTF-8.
- Swift is designed to allow non-English identifiers.
- Reserved words and framework identifiers remain in English.
- Using Japanese for naming identifiers.
In this post, we will call this “Swift programming in Japanese”.
Premise of this post
- Mac
- Xcode
- Swift
- Apple’s development tools and frameworks only
- No special tools and configs
- Based on my personal experience
Out of Scope for This Post
- Advantages and disadvantages of non-English speakers using their native language for programming.
- Whether non-English speakers should program in English.
Feasibility of Japanese identifiers
Consider whether the character can be used as an identifier.
Invalid characters
Xcode will display an error message for invalid characters. It will also fail to compile.
Let's examine characters by category.
Hiragana
Hiragana is the most basic character of the Japanese language.
Counting by Unicode standards, there are 80 characters.
All are valid.
Katakana
Katakana is similar in usage to italic fonts in English.
There are 81 characters.
All are valid.
Kanji
Kanji is Chinese characters adopted into Japanese writing system.
In Japan, about 3000 kanji characters are used.
All are valid.
Symbol
In Japan, these symbols are used. There are 32 symbols.
With regard to symbols, there are characters that can be used and characters that cannot be used.
Invalid Japanese symbols
- 13 invalid characters
- Comma and Period
- Brackets
- Symbols written at the beginning or end of a sentence
- These are generally unnecessary for identifiers
Combining characters
Unicode has a special type of characters.
These are combining characters.
Combining characters decorates one other character to create one new character.
In Japanese, there are combining characters for the voiced and semi-voiced marks.
These are valid.
Alphabet
Many Japanese do not speak English, but they use the alphabet.
It is used in combination with other character types.
Of course, the alphabet can be used as an identifier.
Arabic numerals
Arabic numerals are used in the same way.
Of course, they can be used as identifiers.
All Japanese characters
These are all commonly used Japanese characters. However, there are many more characters in Unicode.
If the number of characters that are actually used infrequently is included, the number is about twice as large.
In total, there are over 6500 characters. Almost all Japanese characters are valid. Invalid characters are only some symbols.
Does Swift compiler build properly?
Here are some concerns that come to mind.
- Are there any bugs?
- Does it behave differently from English?
- Is there any performance loss?
No problem at all.
Does Xcode work properly?
Here are some concerns that come to mind.
- Does it work as a text editor for Japanese in the first place?
- Will suggestions and other features work smoothly?
- Will Japanese fonts display properly?
- It is common to use identifiers as file names. Is it okay to use Japanese file names?
- Is Git built in to Xcode also okay?
All of these are fine. Everything works properly.
Test on Xcode
XCTest requires identifiers to begin with “test”. This is a little disappointing.
This has recently been resolved. In Swift Testing introduced in Xcode 16, there’s no need to prefix with “test”. That's great.
Answer of "Feasibility of Japanese identifiers"
So far, we have examined the feasibility of Japanese identifiers.
In short, Swift and Xcode fully support programming with Japanese identifiers!
Q: So, does everything work perfectly in Japanese?
The answer is NO.
Everything we have discussed so far has been about the inner workings of Swift.
Using Japanese outside of Swift can be risky
For example,
- Xcode project name
- Bundle Identifier
- Name of File, Folder, or Target (* Only when using third-party development tools)
- URL
- Codable (* Only when decoding the data with other tools)
I told you earlier that file names are not a problem. However, please be careful when using third-party development tools. It is up to that development tool whether or not it supports Japanese.
Tips for code completion
In English, code completion is suggested with a single keyboard type. In Japanese, however, multiple keyboard types are required.
Tip 1: Keyboard shortcut
Display code completion using keyboard shortcut.
- control + space
- control + dot
- option + escape
Tip 2: Using “self” or “Self”.
Using “self” or “Self” helps code completion work smoothly.
A medium-size issue: Naming convention
Case conventions are common. Names of types and protocols are UpperCamelCase. Everything else is lowerCamelCase.
However, there isn’t a well-established way to express these conventions in Japanese.
I tried various ways and searched online, but couldn’t find a solution.
* This issue applies to other programming languages as well
As an aside
Apple translates much of official information for developers into Japanese. They are very helpful to Japanese speakers with their high-quality translations.
- Top page
- Feature page
- News
- Video (title, description, subtitles)
- Human Interface Guidelines
All of these have official Japanese translations. These provide strong support for Japanese speakers, especially in keeping up with OS updates + new devices.
By the way, Japanese translations do not exist for the API reference, tutorial series, and Xcode UI. Conversely, there are Japanese translations for all but these three.
As an aside(2)
The Swift Programming Language(日本語版)
https://www.swiftlangjp.com
There is a volunteer project to translate the official Swift reference into Japanese.
Request
Request to Swift and Xcode
As I have explained, Swift and Xcode fully support Japanese identifiers. Therefore, no request was necessary.
There is no requirement for reserved words, frameworks, or Xcode UI to be in Japanese.
Request to Japanese speakers
Let’s write Japanese identifiers!
- No preparation is required because it's pure Swift.
- You can write alongside English, allowing gradual introduction.
- Let’s find the best practices together. Especially naming convention.
Request to Non-English speakers
Let’s write YOUR native language identifiers!
Wrap-up
- Swift works properly with Japanese identifiers.
- It’s unsafe to use Japanese outside Swift.
- Let’s try Swift programming in Japanese.
Links
PlainShogi app
https://apps.apple.com/app/id1620268476
PlainShogi's source code
https://github.com/FlipByBlink/PlainShogi
my GitHub
https://github.com/FlipByBlink
my X
This talk's video
https://www.youtube.com/watch?v=uVgxJpSvp-I
Slide version
https://speakerdeck.com/flipbyblink/swift-programming-in-japanese