Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Monacaでアプリ名の多言語化
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Daisuke Kishino
November 28, 2017
Programming
810
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Monacaでアプリ名の多言語化
Daisuke Kishino
November 28, 2017
More Decks by Daisuke Kishino
See All by Daisuke Kishino
Flutterコンテストを開催した話
kishino
1
480
Monaca、WKWebViewに移行しようぜ!
kishino
0
960
Ionicあらまし@okayama-js
kishino
0
1.1k
MonacaアプリをネイティブのUXに近づけるために
kishino
0
1k
Sign In with Appleを実装してみた
kishino
0
450
Fluid interfaces for Monaca
kishino
0
270
Vue.jsの特徴
kishino
0
620
Other Decks in Programming
See All in Programming
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
120
AI時代のTerminal環境を UNIX哲学で設計・運用する
yasunori0418
1
330
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
380
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
270
Modernizing iOS Apps
seyfoyun
0
150
SODA - FACT BOOK(JP)
sodainc
1
40k
Seven New Principles of Software Engineering
yegor256
0
410
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
1.2k
Enforcing Your Architecture with Unit Tests in the AI Era (Swift Connection X)
steliosf
PRO
1
110
Spec-driven Development with AI
simas
PRO
0
2.2k
GraphQL の onError と Nullability のこれから
quramy
0
200
AIがコードを書いてくれる時代、我々は何を確かめるのか
yosuke_furukawa
PRO
13
5.5k
Featured
See All Featured
Building an army of robots
kneath
307
47k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
380
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
43k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
290
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Thoughts on Productivity
jonyablonski
76
5.4k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.4k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.7k
The Spectacular Lies of Maps
axbom
PRO
1
1.1k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.6k
Site-Speed That Sticks
csswizardry
13
1.6k
Transcript
Monacaでアプリ名の多言語化 Monaca UG TOKYO #3 ~年末のLT大会!~ @2017/11/27
2 ピープルソフトウェア株式会社 岸野 大輔 @岡山県 Monaca歴10ヵ月 最近はAngularJSとかVue.jsとかやってます。 好きな言語はSwift 自己紹介
3 多言語化したアプリ • 会津若松の観光アプリ • Monaca+BaaS@rakuza • OnsenUI+Vue.js • 日本語、英語、中国語(簡・繁)、タイ
語の5か国語に対応
4 アプリの多言語化 • サーバー側 • BaaS@rakuzaで対応 • アプリ側 • OnsenUI+Vue.jsで作っているので、vue-i18nで対応
5 アプリ名は? • リリースの1週間前にアプリ名が多言語化されていないことに気が 付く • Cordova・Monacaに何か仕組みがあるだろうと高を括っていた ら、どうやらなさそう・・ どうしよう!!!
6 ネイティブはどうやるんだっけ? • Android 1. resにvalues-enなど、言語ごとのディレクトリを作成 2. strings.xmlを作成し、「app_name」にアプリ名を記述 • iOS
1. XcodeからInfoPlist.stringを作成し、 Localizationをクリックして各言 語をチェックする 2. InfoPlist.stringの「CFBundleDisplayName」にアプリ名を記述 strings.xmlとInfoPlist.stringをコピーすればよいのでは?
7 CordovaのHook機能を使ってみる • Cordovaの各種操作時に処理を挟み込むことができる • プラグイン追加時、プリペア時など • after_prepare(プリペア後)に、strings.xmlとInfoPlist.stringをコ ピーするHookスクリプトを作成
8 Hookスクリプト Android用の スクリプト iOS用のスク リプト プラグインの 定義ファイル Hookスクリプトは Cordova
Pluginとして作 成
9 plugin.xml
10 Hookスクリプト(Android)
11 コピーするリソースファイル Monacaはルート配下に自由に ファイルを配置できないため、 wwwに配置 phonegap buildがこのディレク トリ構成(Androidだけ)なので真 似た
12 project.pbxprojの罠 • Androidはstrings.xmlをコピーするだけでOK! • iOSはコピーするだけだとうまくいかない・・ • iOSはXcodeに認識させるために、リソースファイル(InfoPlist.string) とそのLocalization設定をproject.pbxprojに定義する必要がある •
Xcode使ってると、よくコンフリクトする謎フォーマットのアレです
13 project.pbxprojの構成 PBXFireReference PBXVariantGroup すべてのリソースファイルを表すク ラス。ここにInfoPlist.stringを言語分 だけ設定する。 ※ en.lprojなど、言語ごとのディレ クトリに配置した上で追加する
Localizationされているファイルの グループを表現するクラス。 InfoPlist.stringsというグループ名を 設定する。 ファイルの ObjectIDを参照
14 node-xcode • project.pbxprojをパース・編集できるnode.jsのライブラリ • このライブラリを使って、 PBXFireReferenceとPBXVariantGroupを 設定 iOSもうまくいった!!
15 (TIPS)node-xcodeのインストール • CustomConfigプラグインを使用していればインストール不要…と 思ったが、Monaca標準のCustomConfigプラグイン(2.0.3)だと node-xcodeのバージョンが古い(0.8.x) • 0.9.xでないと、 PBXVariantGroupの編集ができない •
MonacaのCustomConfigプラグインを最新(4.0.2)にしてみるも、なぜ かビルドでコケる… • npm install xcodeを実行して、node_modules以下をまるごとアップ ロードして解決
16 参考 • cordova-plugin-localization-strings (https://github.com/kelvinhokk/cordova-plugin-localization- strings) • node-xcodeの使い方の参考 • .xcodeproj/project.pbxproj
を解読する (https://qiita.com/yokomotod/items/02e395e99bb891d27f67) • project.pbxprojの仕様の参考
17 ソースコード • GitHubにアップしました https://github.com/kishino/cordova-plugin-i18n-app-name