add i19n
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { Stack } from 'expo-router';
|
||||
import { AuthProvider } from '../context/AuthContext';
|
||||
import '../i18n';
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useCallback, useState } from 'react';
|
||||
import { FlatList, Pressable, StyleSheet, Text, View } from 'react-native';
|
||||
import { getFolder, getFolderFolders, getFiles } from '../../services/localStorage';
|
||||
import type { StoredFile, StoredFolder } from '../../services/db/types';
|
||||
import i18n from '../../i18n';
|
||||
|
||||
type Row = {
|
||||
key: string;
|
||||
@@ -13,9 +14,9 @@ type Row = {
|
||||
};
|
||||
|
||||
function formatSize(bytes: number): string {
|
||||
if ( bytes < 1024 ) return `${bytes} o`;
|
||||
if ( bytes < 1024 * 1024 ) return `${(bytes / 1024).toFixed(1)} Ko`;
|
||||
return `${(bytes / (1024 * 1024)).toFixed(1)} Mo`;
|
||||
if ( bytes < 1024 ) return `${bytes} ${i18n.t('bytes')}`;
|
||||
if ( bytes < 1024 * 1024 ) return `${(bytes / 1024).toFixed(1)} ${i18n.t('kilobytes')}`;
|
||||
return `${(bytes / (1024 * 1024)).toFixed(1)} ${i18n.t('megabytes')}`;
|
||||
}
|
||||
|
||||
export default function FolderScreen() {
|
||||
@@ -48,7 +49,7 @@ export default function FolderScreen() {
|
||||
key: f.resource_id,
|
||||
kind: 'folder' as const,
|
||||
label: f.name,
|
||||
meta: 'Dossier',
|
||||
meta: i18n.t('folder'),
|
||||
resourceId: f.resource_id,
|
||||
})),
|
||||
...files.map((f) => ({
|
||||
@@ -62,7 +63,7 @@ export default function FolderScreen() {
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Stack.Screen options={{ title: folder?.name ?? 'Dossier' }} />
|
||||
<Stack.Screen options={{ title: folder?.name ?? i18n.t('folder') }} />
|
||||
<FlatList
|
||||
data={rows}
|
||||
keyExtractor={(item) => item.key}
|
||||
@@ -79,7 +80,7 @@ export default function FolderScreen() {
|
||||
)}
|
||||
ListEmptyComponent={
|
||||
<Text style={styles.empty}>
|
||||
Dossier vide — le prochain syncDevice l'actualisera.
|
||||
{i18n.t('empty_folder')}
|
||||
</Text>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -6,6 +6,7 @@ import { syncRoot } from '../features/syncDevice';
|
||||
import { pickDirectory } from '../services/safDirectory';
|
||||
import { getFolders, saveDirectory } from '../services/localStorage';
|
||||
import type { StoredFolder } from '../services/db/types';
|
||||
import i18n from '../i18n';
|
||||
|
||||
export default function Index() {
|
||||
|
||||
@@ -40,7 +41,7 @@ export default function Index() {
|
||||
<View style={styles.container}>
|
||||
<StatusBar style="auto" />
|
||||
<Pressable style={styles.button} onPress={handlePickDirectory}>
|
||||
<Text style={styles.buttonText}>Ajouter un dossier</Text>
|
||||
<Text style={styles.buttonText}>{i18n.t('add_folder')}</Text>
|
||||
</Pressable>
|
||||
<FlatList
|
||||
data={roots}
|
||||
@@ -56,7 +57,7 @@ export default function Index() {
|
||||
)}
|
||||
ListEmptyComponent={
|
||||
<Text style={styles.empty}>
|
||||
Aucun dossier pour le moment. Appuie sur « Ajouter un dossier » pour synchroniser un dossier.
|
||||
{i18n.t('no_folders_yet')}
|
||||
</Text>
|
||||
}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user