LoginSignup
6
6

More than 5 years have passed since last update.

iOS開発でLocalizable.stringsがコンフリクトしたときの場当たり的対処

Posted at

iOSの多言語化ファイルであるLocalizable.stringsはUTF-16のため、gitではうまくmergeを行ってくれません(´・ω・`)

対策をググったのですがいまいちうまい方法がわからず、現状自分が落ちついた方法を書いてみたいと思います。うまいやり方をご存じの方はぜひコメントで教えて下さい。

  1. マージ元のLocalizable.stringをLocalizable.strings.oursとして保存する

    git checkout --ours ja.lproj/Localizable.strings
    mv ja.lproj/Localizable.strings ja.lproj/Localizable.strings.ours

  2. マージしたいLocalizable.stringを復元する

    git checkout --theirs ja.lproj/Localizable.strings

  3. Diffを確認する

    # GNU diffはutf-16のファイルをバイナリだと思っちゃうのでvimdiffを使う
    vimdiff ja.lproj/Localizable.strings ja.lproj/Localizable.strings.ours

  4. 手動で頑張ってマージする (つらい)

  5. Localizable.strings.oursを削除してrebase続行

    rm Localizable.strings.ours
    git add Localizable.strings
    git rebase --continue

6
6
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
6
6