Alexandre Lision | 922380d | 2015-09-15 10:25:17 -0400 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Sébastien Blin | 029ffa8 | 2019-01-02 17:43:48 -0500 | [diff] [blame] | 3 | # Copyright (C) 2015-2019 Savoir-faire Linux Inc. |
Alexandre Lision | 922380d | 2015-09-15 10:25:17 -0400 | [diff] [blame] | 4 | # Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com> |
| 5 | # |
| 6 | # This program is free software; you can redistribute it and/or modify |
| 7 | # it under the terms of the GNU General Public License as published by |
| 8 | # the Free Software Foundation; either version 3 of the License, or |
| 9 | # (at your option) any later version. |
| 10 | # |
| 11 | # This program is distributed in the hope that it will be useful, |
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | # GNU General Public License for more details. |
| 15 | # |
| 16 | # You should have received a copy of the GNU General Public License |
| 17 | # along with this program; if not, write to the Free Software |
| 18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 | |
| 20 | # This scripts generates .strings files for Base language (e.g: english) |
| 21 | # These files are encoded in UTF-16LE which is interpreted as binary in Git, |
| 22 | # and therefore not visible when using 'git diff' |
| 23 | |
| 24 | echo "Regenerating Localizable.strings..." |
| 25 | find src -name '*.mm' | xargs genstrings -o ui/Base.lproj |
| 26 | iconv -f UTF-16LE -t UTF-8 ui/Base.lproj/Localizable.strings > ui/Base.lproj/Localizable.strings.8 |
| 27 | sed '1s/.*//' ui/Base.lproj/Localizable.strings.8 > ui/Base.lproj/Localizable.strings |
| 28 | rm ui/Base.lproj/Localizable.strings.8 |
| 29 | |
| 30 | # generate strings from XIBs |
| 31 | |
| 32 | for file in `find ui -name '*.xib' -and -path '*/Base.lproj/*'`; do |
| 33 | strings_file=`echo $file | sed s/\.xib/.strings/` |
| 34 | echo "Regenerating $strings_file..." |
| 35 | ibtool --generate-strings-file $strings_file $file |
| 36 | |
| 37 | # Change file encoding |
| 38 | iconv -f UTF-16LE -t UTF-8 $strings_file > $strings_file.8 |
| 39 | |
| 40 | # Empty first line |
| 41 | sed '1s/.*//' $strings_file.8 > $strings_file |
| 42 | rm $strings_file.8 |
| 43 | done |