diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-31 12:23:26 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-31 12:23:26 +0200 |
commit | 98f5ab5aa00f4d6b83079e6ee4e228b401356198 (patch) | |
tree | 3760877ce19431b821b66ae8b43a9fecea201460 /src/lang.c | |
parent | a7596f683456da5274ecb33d4043a9eb47858c99 (diff) |
Changed format of resources.lgr
Resources are now stored in a ZIP archive, and it comes with an explicit version number. All the old embed/bincat stuff was removed as unnecessary.
resources.lgr is also a valid fontpack, for loading the built-in fonts.
IssueID #363
Diffstat (limited to 'src/lang.c')
-rw-r--r-- | src/lang.c | 56 |
1 files changed, 28 insertions, 28 deletions
@@ -21,7 +21,7 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | 21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ |
22 | 22 | ||
23 | #include "lang.h" | 23 | #include "lang.h" |
24 | #include "embedded.h" | 24 | #include "resources.h" |
25 | 25 | ||
26 | #include <the_Foundation/sortedarray.h> | 26 | #include <the_Foundation/sortedarray.h> |
27 | #include <the_Foundation/string.h> | 27 | #include <the_Foundation/string.h> |
@@ -30,7 +30,7 @@ iDeclareType(Lang) | |||
30 | iDeclareType(MsgStr) | 30 | iDeclareType(MsgStr) |
31 | 31 | ||
32 | struct Impl_MsgStr { | 32 | struct Impl_MsgStr { |
33 | iRangecc id; /* these point to null-terminated strings in embedded data */ | 33 | iRangecc id; /* these point to null-terminated strings in resources */ |
34 | iRangecc str; | 34 | iRangecc str; |
35 | }; | 35 | }; |
36 | 36 | ||
@@ -83,41 +83,41 @@ static void clear_Lang_(iLang *d) { | |||
83 | } | 83 | } |
84 | 84 | ||
85 | static void load_Lang_(iLang *d, const char *id) { | 85 | static void load_Lang_(iLang *d, const char *id) { |
86 | /* Load compiled language strings from an embedded blob. */ | 86 | /* Load compiled language strings from a resource blob. */ |
87 | iUnused(id); | 87 | iUnused(id); |
88 | const iBlock *data = equal_CStr(id, "fi") ? &blobFi_Embedded | 88 | const iBlock *data = equal_CStr(id, "fi") ? &blobFi_Resources |
89 | : equal_CStr(id, "fr") ? &blobFr_Embedded | 89 | : equal_CStr(id, "fr") ? &blobFr_Resources |
90 | : equal_CStr(id, "ru") ? &blobRu_Embedded | 90 | : equal_CStr(id, "ru") ? &blobRu_Resources |
91 | : equal_CStr(id, "eo") ? &blobEo_Embedded | 91 | : equal_CStr(id, "eo") ? &blobEo_Resources |
92 | : equal_CStr(id, "es") ? &blobEs_Embedded | 92 | : equal_CStr(id, "es") ? &blobEs_Resources |
93 | : equal_CStr(id, "es_MX") ? &blobEs_MX_Embedded | 93 | : equal_CStr(id, "es_MX") ? &blobEs_MX_Resources |
94 | : equal_CStr(id, "de") ? &blobDe_Embedded | 94 | : equal_CStr(id, "de") ? &blobDe_Resources |
95 | : equal_CStr(id, "gl") ? &blobGl_Embedded | 95 | : equal_CStr(id, "gl") ? &blobGl_Resources |
96 | : equal_CStr(id, "ia") ? &blobIa_Embedded | 96 | : equal_CStr(id, "ia") ? &blobIa_Resources |
97 | : equal_CStr(id, "ie") ? &blobIe_Embedded | 97 | : equal_CStr(id, "ie") ? &blobIe_Resources |
98 | : equal_CStr(id, "isv") ? &blobIsv_Embedded | 98 | : equal_CStr(id, "isv") ? &blobIsv_Resources |
99 | : equal_CStr(id, "pl") ? &blobPl_Embedded | 99 | : equal_CStr(id, "pl") ? &blobPl_Resources |
100 | : equal_CStr(id, "sk") ? &blobSk_Embedded | 100 | : equal_CStr(id, "sk") ? &blobSk_Resources |
101 | : equal_CStr(id, "sr") ? &blobSr_Embedded | 101 | : equal_CStr(id, "sr") ? &blobSr_Resources |
102 | : equal_CStr(id, "tok") ? &blobTok_Embedded | 102 | : equal_CStr(id, "tok") ? &blobTok_Resources |
103 | : equal_CStr(id, "uk") ? &blobUk_Embedded | 103 | : equal_CStr(id, "uk") ? &blobUk_Resources |
104 | : equal_CStr(id, "zh_Hans") ? &blobZh_Hans_Embedded | 104 | : equal_CStr(id, "zh_Hans") ? &blobZh_Hans_Resources |
105 | : equal_CStr(id, "zh_Hant") ? &blobZh_Hant_Embedded | 105 | : equal_CStr(id, "zh_Hant") ? &blobZh_Hant_Resources |
106 | : &blobEn_Embedded; | 106 | : &blobEn_Resources; |
107 | if (data == &blobRu_Embedded || data == &blobSr_Embedded || data == &blobUk_Embedded) { | 107 | if (data == &blobRu_Resources || data == &blobSr_Resources || data == &blobUk_Resources) { |
108 | d->pluralType = slavic_PluralType; | 108 | d->pluralType = slavic_PluralType; |
109 | } | 109 | } |
110 | else if (data == &blobIsv_Embedded) { | 110 | else if (data == &blobIsv_Resources) { |
111 | d->pluralType = oneTwoMany_PluralType; | 111 | d->pluralType = oneTwoMany_PluralType; |
112 | } | 112 | } |
113 | else if (data == &blobSk_Embedded) { | 113 | else if (data == &blobSk_Resources) { |
114 | d->pluralType = oneFewMany_PluralType; | 114 | d->pluralType = oneFewMany_PluralType; |
115 | } | 115 | } |
116 | else if (data == &blobPl_Embedded) { | 116 | else if (data == &blobPl_Resources) { |
117 | d->pluralType = polish_PluralType; | 117 | d->pluralType = polish_PluralType; |
118 | } | 118 | } |
119 | else if (data == &blobZh_Hans_Embedded || data == &blobZh_Hant_Embedded || | 119 | else if (data == &blobZh_Hans_Resources || data == &blobZh_Hant_Resources || |
120 | data == &blobTok_Embedded) { | 120 | data == &blobTok_Resources) { |
121 | d->pluralType = none_PluralType; | 121 | d->pluralType = none_PluralType; |
122 | } | 122 | } |
123 | else { | 123 | else { |