1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 01:00:25 +00:00

Merge pull request #309 from Technochips/master

WIP: French improvements
This commit is contained in:
Zeno Rogue 2022-07-05 21:12:59 +02:00 committed by GitHub
commit 7fda3c08c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 320 additions and 312 deletions

View File

@ -111,6 +111,10 @@ struct hr_shortest_path_exception { };
#define GEN_N 2 #define GEN_N 2
#define GEN_O 3 #define GEN_O 3
#define GENF_ELISION (4 << 0)
#define GENF_PLURALONLY (4 << 1)
#define GENF_PROPER (4 << 2)
// Add a message to the GUI. // Add a message to the GUI.
// If multiple messages appear with the same spamtype != 0, the older ones disappear quickly // If multiple messages appear with the same spamtype != 0, the older ones disappear quickly
void addMessage(string s, char spamtype = 0); void addMessage(string s, char spamtype = 0);

View File

@ -14,6 +14,10 @@
#define GEN_N 2 #define GEN_N 2
#define GEN_O 3 #define GEN_O 3
#define GENF_ELISION (1 << 3)
#define GENF_PLURALONLY (1 << 4)
#define GENF_PROPER (1 << 5)
#if MAC #if MAC
#define IF_MAC(y,z) y #define IF_MAC(y,z) y
#else #else

File diff suppressed because it is too large Load Diff

View File

@ -96,23 +96,23 @@ template<class T> const T* findInHashTableS(string s, const T *table, int size)
#endif #endif
string choose2(int g, string a, string b) { string choose2(int g, string a, string b) {
if(g == GEN_M || g == GEN_O) return a; if((g & 0b11) == GEN_M || (g & 0b11) == GEN_O) return a;
if(g == GEN_F || g == GEN_N) return b; if((g & 0b11) == GEN_F || (g & 0b11) == GEN_N) return b;
return "?" + a; return "?" + a;
} }
string choose3(int g, string a, string b, string c) { string choose3(int g, string a, string b, string c) {
if(g == GEN_M || g == GEN_O) return a; if((g & 0b11) == GEN_M || (g & 0b11) == GEN_O) return a;
if(g == GEN_F) return b; if((g & 0b11) == GEN_F) return b;
if(g == GEN_N) return c; if((g & 0b11) == GEN_N) return c;
return "?" + a; return "?" + a;
} }
string choose4(int g, string a, string b, string c, string d) { string choose4(int g, string a, string b, string c, string d) {
if(g == GEN_M) return a; if((g & 0b11) == GEN_M) return a;
if(g == GEN_F) return b; if((g & 0b11) == GEN_F) return b;
if(g == GEN_N) return c; if((g & 0b11) == GEN_N) return c;
if(g == GEN_O) return d; if((g & 0b11) == GEN_O) return d;
return "?" + a; return "?" + a;
} }
@ -183,28 +183,31 @@ void genderrep(string& x, const string& w, const noun& N) {
} }
if(l == 7) { if(l == 7) {
bool vowel = among(N.nom[0], 'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'); if(genus & GENF_PROPER)
if(N.nom[0]) vowel = vowel || among(s0+N.nom[0] + N.nom[1], "É"); {
if(vowel) { rep(x, "%le"+w, N.nom);
rep(x, "%Le"+w, N.nom);
rep(x, "%un"+w, N.nom);
rep(x, "%Un"+w, N.nom);
}
else if(genus & GENF_PLURALONLY)
{
rep(x, "%le"+w, s0+"les "+N.nomp);
rep(x, "%Le"+w, s0+"Les "+N.nomp);
rep(x, "%un"+w, s0+"des "+N.nomp);
rep(x, "%Un"+w, s0+"Des "+N.nomp);
}
else if(genus & GENF_ELISION)
{
rep(x, "%le"+w, s0+"l'"+N.nom); rep(x, "%le"+w, s0+"l'"+N.nom);
rep(x, "%Le"+w, s0+"L'"+N.nom); rep(x, "%Le"+w, s0+"L'"+N.nom);
rep(x, "%lea"+w, s0+"l'"+N.acc);
rep(x, "%Lea"+w, s0+"L'"+N.acc);
rep(x, "%led"+w, s0+"l'"+N.abl);
rep(x, "%Led"+w, s0+"L'"+N.abl);
} }
else {
if(genus == 0) { if(genus == 0) {
rep(x, " de %le"+w, s0+" du "+N.nom); rep(x, " de %le"+w, s0+" du "+N.nom);
rep(x, " à %le"+w, s0+" au "+N.nom); rep(x, " à %le"+w, s0+" au "+N.nom);
} }
rep(x, "%le"+w, choose2(genus, "le ", "la ")+N.nom); rep(x, "%le"+w, choose2(genus, "le ", "la ")+N.nom);
rep(x, "%Le"+w, choose2(genus, "Le ", "La ")+N.nom); rep(x, "%Le"+w, choose2(genus, "Le ", "La ")+N.nom);
rep(x, "%lea"+w, choose2(genus, "le ", "la ")+N.acc);
rep(x, "%Lea"+w, choose2(genus, "Le ", "La ")+N.acc);
rep(x, "%led"+w, choose2(genus, "le ", "la ")+N.abl);
rep(x, "%Led"+w, choose2(genus, "Le ", "La ")+N.abl);
}
rep(x, "%un"+w, choose2(genus, "un ", "une ")+N.nom); rep(x, "%un"+w, choose2(genus, "un ", "une ")+N.nom);
rep(x, "%Un"+w, choose2(genus, "Un ", "Une ")+N.nom); rep(x, "%Un"+w, choose2(genus, "Un ", "Une ")+N.nom);
} }