@@ -3,7 +3,15 @@ import { useCallback, useState } from 'react';
33import { useTranslation } from 'react-i18next' ;
44import { Box } from 'react-native-flex-layout' ;
55import type { ModalProps } from 'react-native-paper' ;
6- import { Button , Portal , RadioButton , Text } from 'react-native-paper' ;
6+ import {
7+ Button ,
8+ Portal ,
9+ RadioButton ,
10+ Text ,
11+ useTheme ,
12+ } from 'react-native-paper' ;
13+
14+ import { Linking } from 'react-native' ;
715
816import { setLanguage } from '@/slices/settings' ;
917
@@ -13,6 +21,7 @@ import useAppLanguage from '@/hooks/useAppLanguage';
1321
1422import { rootLogging } from '@/utils/log' ;
1523
24+ import { colors , weblateUrl } from '@/constants' ;
1625import { useAppDispatch } from '@/store' ;
1726import type { SupportedLanguage } from '@/translations' ;
1827import { supportedLanguages } from '@/translations' ;
@@ -23,6 +32,7 @@ const ChangeLanguageModal: FC<Omit<ModalProps, 'children'>> = props => {
2332 const { onDismiss } = props ;
2433 const dispatch = useAppDispatch ( ) ;
2534 const { t } = useTranslation ( ) ;
35+ const theme = useTheme ( ) ;
2636
2737 const language = useAppLanguage ( ) ;
2838
@@ -39,11 +49,20 @@ const ChangeLanguageModal: FC<Omit<ModalProps, 'children'>> = props => {
3949 onDismiss ?.( ) ;
4050 } , [ dispatch , onDismiss , selectedLanguage ] ) ;
4151
52+ const handleOpenWeblate = useCallback ( async ( ) => {
53+ if ( await Linking . canOpenURL ( weblateUrl ) ) {
54+ await Linking . openURL ( weblateUrl ) ;
55+ } else {
56+ // TODO: Better error handling (issue #101)
57+ log . error ( 'Cannot open Weblate URL' ) ;
58+ }
59+ } , [ ] ) ;
60+
4261 return (
4362 < Portal >
4463 < BaseModal { ...props } >
45- < Box p = { 16 } >
46- < Box mb = { 8 } >
64+ < Box p = { 8 } >
65+ < Box m = { 8 } >
4766 < Text variant = "bodyLarge" > { t ( 'settings.changeTheLanguage' ) } </ Text >
4867 </ Box >
4968 < RadioButton . Group
@@ -60,6 +79,24 @@ const ChangeLanguageModal: FC<Omit<ModalProps, 'children'>> = props => {
6079 />
6180 ) ) }
6281 </ RadioButton . Group >
82+ < Box
83+ mt = { 16 }
84+ style = { {
85+ gap : 8 ,
86+ backgroundColor : theme . colors . elevation . level1 ,
87+ padding : 8 ,
88+ borderRadius : theme . roundness * 4 ,
89+ } }
90+ >
91+ < Text variant = "bodyMedium" > { t ( 'settings.weblateInfo' ) } </ Text >
92+ < Button
93+ buttonColor = { colors . weblate }
94+ textColor = { colors . onWeblate }
95+ onPress = { handleOpenWeblate }
96+ >
97+ { t ( 'settings.openWeblate' ) }
98+ </ Button >
99+ </ Box >
63100 < Box
64101 mt = { 16 }
65102 style = { {
0 commit comments