Add language dropdown to compose view (#2651)

* Add UI for selecting post language

* Apply selected language when sending status

* Save/restore post language with drafts

* Fall back to english if the configured language isn't found in the locale list (no-NB)

* Remove comment about no_NB

* Move language dropdown to top of compose view

* Preserve language when redrafting

* Set default language to target post's language when replying

* Add Tusky license header to new source file

* Tweak language dropdown button width
This commit is contained in:
Levi Bard 2022-08-31 18:53:57 +02:00 committed by GitHub
commit 0041acf2d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 1140 additions and 28 deletions

View file

@ -99,7 +99,8 @@ fun Placeholder.toEntity(timelineUserId: Long): TimelineStatusEntity {
contentShowing = false,
pinned = false,
card = null,
repliesCount = 0
repliesCount = 0,
language = null,
)
}
@ -141,7 +142,8 @@ fun Status.toEntity(
contentCollapsed = contentCollapsed,
pinned = actionableStatus.pinned == true,
card = actionableStatus.card?.let(gson::toJson),
repliesCount = actionableStatus.repliesCount
repliesCount = actionableStatus.repliesCount,
language = actionableStatus.language,
)
}
@ -185,7 +187,8 @@ fun TimelineStatusWithAccount.toViewData(gson: Gson): StatusViewData {
muted = status.muted,
poll = poll,
card = card,
repliesCount = status.repliesCount
repliesCount = status.repliesCount,
language = status.language,
)
}
val status = if (reblog != null) {
@ -216,6 +219,7 @@ fun TimelineStatusWithAccount.toViewData(gson: Gson): StatusViewData {
poll = null,
card = null,
repliesCount = status.repliesCount,
language = status.language,
)
} else {
Status(
@ -245,6 +249,7 @@ fun TimelineStatusWithAccount.toViewData(gson: Gson): StatusViewData {
poll = poll,
card = card,
repliesCount = status.repliesCount,
language = status.language,
)
}
return StatusViewData.Concrete(