Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

Commit

Permalink
Merge branch 'develop' into feature/138-mentions
Browse files Browse the repository at this point in the history
# Conflicts:
#	lib/services/localization.dart
  • Loading branch information
lifenautjoe committed Aug 12, 2019
2 parents 40f5349 + af94589 commit 5648165
Show file tree
Hide file tree
Showing 122 changed files with 32,139 additions and 1,274 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,34 @@ flutter run --profile
5. Copy the contents of the downloaded archive to assets/i18n
6. Run `make build_locale`

### 7.c Localized Locales
At Okuna, we wanted to support different combinations of languages and country codes. For eg.
Someone could want Brazilian Portugese as their language but choose country Netherlands since they live there. The country could be relevant
for location relevant content, payments etc. while the language is just what the user prefers.

Most locale frameworks only allow locale `pt,BR` which means Brazilian portuguese but this also sets the country code in the locale
object to Brazil which may not always be the case.

Therefore, localized locales are locales that have a language code that looks like this for eg. `pt-BR` and in addition also a country code. Which makes the locale object
`Locale('pt-BR', 'BR);` Our API supports many such languages which have different localized versions and we can add new languages as required.


While looking for loading locale files when a locale change takes place, the `intl` library converts a locale to a canonical name where dashes in language codes become underscores.
The canonical names for `Locale('nl','NL')` would be `nl_NL`, ie `languageCode_countryCode`. The `intl` package, first looks for if a language
exists with that and if not found, next splits this on the underscore and looks for `nl`.

With our custom localizedLocales, `intl` library converts this to `pt_BR_BR`. This confuses the `intl` package as the language is stored with it as `pt_BR`.
(See method `__findExact` in the auto-generated file `messages_all.dart` for in-depth code) . To deal with locale changes, we maintain a `localizedLocales` list in the `localization.dart` service which tells the
localization service to only pass along `pt_BR`to `intl` when it encounters a localizedLocale. This ensures it finds the right match and loads the locale.

In addition,a small note, we convert the `Accept-language` header in `httpie.dart` to lowercase since django expects it like that and this header is case sensitive. So django will not recognise
`pt-BR` but recognises `pt-br`.

To summarise, in order to onboard a new localized locale,
1. Create a folder in i18n with the localized language code, for.eg `pt-BR` and store the arb files there.
2. Add the localized locale code to the `localizedLocales` list in `localization.dart`.
3. Run `make build_locale` as is standard.

### 8. Contribute!

Help us keep Okuna going! Please look into our open issues. All contribution, no matter how small, makes a big difference.
Expand Down
22 changes: 11 additions & 11 deletions assets/i18n/de/auth.arb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"headline": "Besser sozial.",
"headline": "Better social.",
"@headline": {
"type": "text",
"placeholders": {
Expand Down Expand Up @@ -41,7 +41,7 @@

}
},
"username_maxlength_error": "Ein Benutzername darf nicht länger als {maxLength} Zeichen sein.",
"username_maxlength_error": "Ein Benutzername darf nicht mehr als {maxLength} Zeichen haben.",
"@username_maxlength_error": {
"type": "text",
"placeholders": {
Expand All @@ -64,8 +64,8 @@

}
},
"create_acc__welcome_to_alpha": "Willkommen in der Alpha!",
"@create_acc__welcome_to_alpha": {
"create_acc__welcome_to_beta": "Willkommen zur Beta!",
"@create_acc__welcome_to_beta": {
"type": "text",
"placeholders": {

Expand Down Expand Up @@ -172,7 +172,7 @@

}
},
"description_range_error": "Beschreibung muss zwischen {minLength} und {maxLength} Zeichen sein.",
"description_range_error": "Beschreibung muss zwischen {minLength} und {maxLength} Zeichen lang sein.",
"@description_range_error": {
"type": "text",
"placeholders": {
Expand Down Expand Up @@ -261,7 +261,7 @@

}
},
"create_acc__name_length_error": "😱 Dein Name darf nicht länger als 50 Zeichen sein. (Wenn er das ist, entschuldigen wir uns sehr.)",
"create_acc__name_length_error": "😱 Dein Name darf maximal 50 Zeichen haben. (Falls er länger ist, tut es uns sehr Leid)",
"@create_acc__name_length_error": {
"type": "text",
"placeholders": {
Expand Down Expand Up @@ -324,14 +324,14 @@

}
},
"create_acc__what_email": "Was ist deine E-Mail?",
"create_acc__what_email": "Wie lautet deine E-Mail-Adresse?",
"@create_acc__what_email": {
"type": "text",
"placeholders": {

}
},
"create_acc__email_placeholder": "fritz_fantom@mail.com",
"create_acc__email_placeholder": "fritz_fantom@mail.de",
"@create_acc__email_placeholder": {
"type": "text",
"placeholders": {
Expand Down Expand Up @@ -359,7 +359,7 @@

}
},
"create_acc__email_server_error": "😭 Wir haben derzeit Probleme mit unseren Servern, versuch es in ein paar Minuten erneut.",
"create_acc__email_server_error": "😭 Ein Serverproblem ist aufgetreten, bitte versuche es später noch einmal.",
"@create_acc__email_server_error": {
"type": "text",
"placeholders": {
Expand Down Expand Up @@ -420,14 +420,14 @@

}
},
"create_acc__avatar_choose_camera": "Ein Foto machen",
"create_acc__avatar_choose_camera": "Foto aufnehmen",
"@create_acc__avatar_choose_camera": {
"type": "text",
"placeholders": {

}
},
"create_acc__avatar_choose_gallery": "Ein bestehendes Foto verwenden",
"create_acc__avatar_choose_gallery": "Vorhandenes Bild auswählen",
"@create_acc__avatar_choose_gallery": {
"type": "text",
"placeholders": {
Expand Down
46 changes: 23 additions & 23 deletions assets/i18n/de/community.arb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

}
},
"button_staff": "Mitarbeiter",
"button_staff": "Moderatoren",
"@button_staff": {
"type": "text",
"placeholders": {
Expand All @@ -34,7 +34,7 @@

}
},
"communities": "communitys",
"communities": "Communities",
"@communities": {
"type": "text",
"placeholders": {
Expand Down Expand Up @@ -69,7 +69,7 @@

}
},
"admin_desc": "Dies ermöglicht dem Mitglied, die Community-Details, Administratoren, Moderatoren und gesperrte Benutzer zu bearbeiten.",
"admin_desc": "Dies ermöglicht dem Mitglied, folgendes zu bearbeiten: Die Community-Details, Administratoren, Moderatoren und gesperrte Benutzer.",
"@admin_desc": {
"type": "text",
"placeholders": {
Expand All @@ -83,7 +83,7 @@

}
},
"admin_add_confirmation": "Bist du sicher, dass du @{username} als Administrator der Community hinzufügen möchtest?",
"admin_add_confirmation": "Bist du sicher, dass du @{username} als einen Administrator der Community hinzufügen möchtest?",
"@admin_add_confirmation": {
"type": "text",
"placeholders": {
Expand Down Expand Up @@ -117,7 +117,7 @@
}
}
},
"moderator_desc": "Dies ermöglicht dem Mitglied, die Community-Details, Moderatoren und gesperrte Benutzer zu bearbeiten.",
"moderator_desc": "Dies ermöglicht dem Mitglied, folgendes zu bearbeiten: Die Community-Details, Moderatoren und gesperrte Benutzer.",
"@moderator_desc": {
"type": "text",
"placeholders": {
Expand All @@ -138,7 +138,7 @@

}
},
"leave_desc": "Du wirst keine Beiträge dieser Community in deiner Timeline sehen, und auch keine Beiträge mehr mit der Community teilen können.",
"leave_desc": "Du wirst keine Beiträge dieser Community in deiner Timeline sehen, und auch keine Beiträge mehr mit dieser Community teilen können.",
"@leave_desc": {
"type": "text",
"placeholders": {
Expand Down Expand Up @@ -180,7 +180,7 @@

}
},
"delete_desc": "Du wirst keine Beiträge dieser Community in deiner Timeline sehen, und auch keine Beiträge mehr mit der Community teilen können.",
"delete_desc": "Du wirst keine Beiträge dieser Community in deiner Timeline sehen, und auch keine Beiträge mehr mit dieser Community teilen können.",
"@delete_desc": {
"type": "text",
"placeholders": {
Expand Down Expand Up @@ -264,7 +264,7 @@

}
},
"manage_mod_reports_desc": "Überprüfe die Community-Moderationsberichte.",
"manage_mod_reports_desc": "Überprüfe die Meldungen an die Community.",
"@manage_mod_reports_desc": {
"type": "text",
"placeholders": {
Expand Down Expand Up @@ -292,7 +292,7 @@

}
},
"manage_invite_desc": "Lade deine Verbindungen und Abonnenten ein, dieser Community beizutreten.",
"manage_invite_desc": "Lade deine Verbindungen und Follower ein, dieser Community beizutreten.",
"@manage_invite_desc": {
"type": "text",
"placeholders": {
Expand Down Expand Up @@ -362,7 +362,7 @@

}
},
"refreshing": "Community aktualisieren",
"refreshing": "Community neu laden",
"@refreshing": {
"type": "text",
"placeholders": {
Expand Down Expand Up @@ -464,7 +464,7 @@

}
},
"pick_upto_max": "Aufnahme von bis zu {max} Kategorien",
"pick_upto_max": "Wähle bis zu {max} Kategorien",
"@pick_upto_max": {
"type": "text",
"placeholders": {
Expand Down Expand Up @@ -493,7 +493,7 @@
}
}
},
"ban_user_title": "Benutzer sperren",
"ban_user_title": "Benutzer aussperren",
"@ban_user_title": {
"type": "text",
"placeholders": {
Expand Down Expand Up @@ -530,15 +530,15 @@

}
},
"favorite_community": "Favorisierte Community",
"favorite_community": "Meine Community",
"@favorite_community": {
"description": "Currently unsused, reserved for potential use. Could be used as Showing 1 favorite community",
"type": "text",
"placeholders": {

}
},
"favorite_communities": "Favorisierte Communitys",
"favorite_communities": "favorisierte Communities",
"@favorite_communities": {
"description": "Egs. Search favorite communities, See list_search_text in user_search.arb ",
"type": "text",
Expand Down Expand Up @@ -584,7 +584,7 @@

}
},
"moderated_communities": "moderierte Communitys",
"moderated_communities": "moderierte Communities",
"@moderated_communities": {
"description": "Egs. Search moderated communities, See list_search_text in user_search.arb ",
"type": "text",
Expand All @@ -607,15 +607,15 @@

}
},
"joined_communities": "Beigetretene Communitys",
"joined_communities": "Beigetretene Communities",
"@joined_communities": {
"description": "Egs. Search joined communities, See list_search_text in user_search.arb ",
"type": "text",
"placeholders": {

}
},
"join_communities_desc": "Werde Mitglied von Communitys und erlebe, wie diese Registerkarte zum Leben erwacht!",
"join_communities_desc": "Werde Mitglied von Communities und diese Registerkarte erwacht zum Leben!",
"@join_communities_desc": {
"type": "text",
"placeholders": {
Expand All @@ -629,7 +629,7 @@

}
},
"trending_none_found": "Keine Communitys im Trend gefunden. Versuche es in ein paar Minuten erneut.",
"trending_none_found": "Keine angesagten Communities gefunden. Versuche es in ein paar Minuten erneut.",
"@trending_none_found": {
"type": "text",
"placeholders": {
Expand All @@ -643,7 +643,7 @@

}
},
"trending_in_all": "In allen Kategorien angesagt",
"trending_in_all": "Angesagt in allen Kategorien",
"@trending_in_all": {
"type": "text",
"placeholders": {
Expand All @@ -659,7 +659,7 @@
}
}
},
"communities_title": "Communitys",
"communities_title": "Communities",
"@communities_title": {
"type": "text",
"placeholders": {
Expand Down Expand Up @@ -710,7 +710,7 @@

}
},
"favorite_action": "Favorisierte Community",
"favorite_action": "Community favorisieren",
"@favorite_action": {
"type": "text",
"placeholders": {
Expand Down Expand Up @@ -894,7 +894,7 @@

}
},
"actions_invite_people_title": "Personen in die Community einladen",
"actions_invite_people_title": "Lade jemanden in die Community ein",
"@actions_invite_people_title": {
"type": "text",
"placeholders": {
Expand All @@ -915,7 +915,7 @@

}
},
"community_staff": "Community-Personal",
"community_staff": "Community-Moderatoren",
"@community_staff": {
"type": "text",
"placeholders": {
Expand Down
Loading

0 comments on commit 5648165

Please sign in to comment.