implement new translation

This commit is contained in:
sk
2023-09-29 18:46:26 +02:00
parent 380e4ff77e
commit c261214e49
10 changed files with 295 additions and 179 deletions

View File

@@ -45,56 +45,10 @@
android:visibility="gone"
android:importantForAccessibility="no"/>
<org.joinmastodon.android.ui.views.AutoOrientationLinearLayout
android:id="@+id/translate_wrap"
<ViewStub
android:id="@+id/translation_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="6dp"
android:gravity="center_vertical"
android:visibility="gone">
<FrameLayout
android:id="@+id/action_btn_wrap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="6dp"
android:clipToPadding="false">
<org.joinmastodon.android.ui.views.ProgressBarButton
android:id="@+id/translate_btn"
style="@style/Widget.Mastodon.M3.Button.Text"
android:textColor="?colorM3OnSurfaceVariant"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:minWidth="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="@string/sk_translate_post"/>
<ProgressBar
android:id="@+id/translate_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminate="true"
style="?android:progressBarStyleSmall"
android:elevation="10dp"
android:outlineProvider="none"
android:visibility="gone"/>
</FrameLayout>
<Space
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="@+id/translate_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:textColor="?colorM3OnSurfaceVariant"
android:textAlignment="textEnd"
tools:text="Translated using TranslateEngine" />
</org.joinmastodon.android.ui.views.AutoOrientationLinearLayout>
android:layout="@layout/footer_text_translation"/>
</LinearLayout>

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="6dp"
android:gravity="center_vertical">
<FrameLayout
android:id="@+id/translation_btn_wrap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="6dp"
android:clipToPadding="false">
<ProgressBar
android:id="@+id/translation_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="10dp"
android:layout_marginEnd="8dp"
android:indeterminate="true"
style="?android:progressBarStyleSmall"
android:visibility="gone"/>
<Button
android:id="@+id/translation_btn"
style="@style/Widget.Mastodon.M3.Button.Text"
android:textColor="?colorM3OnSurfaceVariant"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/translation_show_original"/>
</FrameLayout>
<TextView
android:id="@+id/translation_info_text"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:maxLines="1"
android:ellipsize="end"
android:textAppearance="@style/m3_body_small"
android:textColor="?colorM3OnSurfaceVariant"
android:textAlignment="textEnd"
tools:text="Translated using TranslateEngine" />
</LinearLayout>

View File

@@ -589,4 +589,23 @@
<string name="time_minutes_ago_short">%dm ago</string>
<string name="time_hours_ago_short">%dh ago</string>
<string name="time_days_ago_short">%dd ago</string>
<!-- %s is the name of the post language -->
<string name="translate_post">Translate from %s</string>
<!-- %1$s is the language, %2$s is the name of the translation service -->
<string name="post_translated">Translated from %1$s using %2$s</string>
<string name="translation_show_original">Show original</string>
<string name="translation_failed">Translation failed. Maybe the administrator has not enabled translations on this server or this server is running an older version of Mastodon where translations are not yet supported.</string>
<string name="settings_privacy">Privacy and reach</string>
<string name="settings_discoverable">Feature profile and posts in discovery algorithms</string>
<string name="settings_indexable">Include public posts in search results</string>
<plurals name="x_participants">
<item quantity="one">%,d participant</item>
<item quantity="other">%,d participants</item>
</plurals>
<plurals name="x_posts_today">
<item quantity="one">%,d post today</item>
<item quantity="other">%,d posts today</item>
</plurals>
</resources>