LoginSignup
1
4

More than 5 years have passed since last update.

custom-configプラグインの利用

Last updated at Posted at 2017-05-16

概要

「info.plist」の設定値を「config.xml」から指定できるようになります

「cordova-custom-config」を利用します
基本的にはこちらに書いてある通り
https://github.com/dpa99c/cordova-custom-config

プラグインの導入

$ cordova plugin add cordova-custom-config --fetch --save

使い方

config.xmlの編集

今回は「info.plist」の「Localization」を「config.xml」から指定します

<platform name="ios">

[その他のiosの設定がずらずら]

  <config-file parent="CFBundleLocalizations" platform="ios" target="*-Info.plist">
    <array>
      <string>en</string>
      <string>ja</string>
    </array>
  </config-file>
</platform>

parentの値、stringの値は、実際に「info.plist」ファイルをテキストエディタで確認して指定

ビルドを実行すれば「info.plist」に反映される

$ cordova build ios

反映された「info.plist」の一部

<key>CFBundleLocalizations</key>
<array>
  <string>en</string>
  <string>ja</string>
</array>

XCode上の表示
image.png

その他

「config.xml」ファイルは各 platform ごとに生成される
[プロジェクト名]/platforms/ios/[プロジェクト名]/config.xml

ちなみにplistは
[プロジェクト名]/platforms/ios/[プロジェクト名]/[プロジェクト名]-Info.plist

1
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
4