forge
Clone
https://git.tahinli.com/Tahinli/forge.git
0 watching·0 forks·Rust·AGPL-3.0·7.1 MiB·490f099·Tahinli·7 hours ago·322 commits
| 1 | //! Strings for importing repositories and exporting account data. Same pattern as the other |
| 2 | //! groups: one variant per phrase, an exhaustive `t`, so a missing translation fails to compile. |
| 3 | |
| 4 | use super::Lang; |
| 5 | |
| 6 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
| 7 | pub enum K { |
| 8 | // New repository tabs. |
| 9 | TabCreate, |
| 10 | TabImport, |
| 11 | // Import form. |
| 12 | ImportTitle, |
| 13 | SrcGit, |
| 14 | SrcGitHub, |
| 15 | SrcGitLab, |
| 16 | SrcForgejo, |
| 17 | GitUrl, |
| 18 | GitUser, |
| 19 | GitPassword, |
| 20 | GitHubRepo, |
| 21 | GitLabInstance, |
| 22 | GitLabProject, |
| 23 | ForgejoInstance, |
| 24 | TokenOptional, |
| 25 | TargetOwner, |
| 26 | TargetName, |
| 27 | Description, |
| 28 | WhatToImport, |
| 29 | OptLabels, |
| 30 | OptIssues, |
| 31 | OptPulls, |
| 32 | OptReleases, |
| 33 | StartImport, |
| 34 | BulkLink, |
| 35 | BulkLinkButton, |
| 36 | // Bulk import. |
| 37 | BulkTitle, |
| 38 | BulkOwnerGitHub, |
| 39 | BulkOwnerGitLab, |
| 40 | BulkOwnerForgejo, |
| 41 | BulkListButton, |
| 42 | BulkSelectHeading, |
| 43 | BulkSelectAll, |
| 44 | BulkImportSelected, |
| 45 | BulkNone, |
| 46 | BulkPrivate, |
| 47 | BulkFork, |
| 48 | BulkArchived, |
| 49 | // Jobs. |
| 50 | JobsTitle, |
| 51 | NoJobs, |
| 52 | JobQueued, |
| 53 | JobRunning, |
| 54 | JobDone, |
| 55 | JobFailed, |
| 56 | JobRetry, |
| 57 | JobOpenRepo, |
| 58 | JobProgress, |
| 59 | JobNoLog, |
| 60 | JobStarted, |
| 61 | RetryFailedTitle, |
| 62 | RetrySelected, |
| 63 | RetryNone, |
| 64 | StageGit, |
| 65 | StageLabels, |
| 66 | StageMilestones, |
| 67 | StageIssues, |
| 68 | StageReleases, |
| 69 | StageDone, |
| 70 | // Errors. |
| 71 | ErrBadRemote, |
| 72 | ErrBadInstance, |
| 73 | ErrBadOwner, |
| 74 | ErrNothingSelected, |
| 75 | ErrTooMany, |
| 76 | // Data export. |
| 77 | SettingsExport, |
| 78 | ExportTitle, |
| 79 | ExportRequest, |
| 80 | ExportBuilding, |
| 81 | ExportReady, |
| 82 | ExportFailed, |
| 83 | ExportDownload, |
| 84 | ExportNone, |
| 85 | ExportRequested, |
| 86 | ExportSize, |
| 87 | } |
| 88 | |
| 89 | #[cfg(test)] |
| 90 | const ALL: &[K] = &[ |
| 91 | K::TabCreate, |
| 92 | K::TabImport, |
| 93 | K::ImportTitle, |
| 94 | K::SrcGit, |
| 95 | K::SrcGitHub, |
| 96 | K::SrcGitLab, |
| 97 | K::SrcForgejo, |
| 98 | K::GitUrl, |
| 99 | K::GitUser, |
| 100 | K::GitPassword, |
| 101 | K::GitHubRepo, |
| 102 | K::GitLabInstance, |
| 103 | K::GitLabProject, |
| 104 | K::ForgejoInstance, |
| 105 | K::TokenOptional, |
| 106 | K::TargetOwner, |
| 107 | K::TargetName, |
| 108 | K::Description, |
| 109 | K::WhatToImport, |
| 110 | K::OptLabels, |
| 111 | K::OptIssues, |
| 112 | K::OptPulls, |
| 113 | K::OptReleases, |
| 114 | K::StartImport, |
| 115 | K::BulkLink, |
| 116 | K::BulkLinkButton, |
| 117 | K::BulkTitle, |
| 118 | K::BulkOwnerGitHub, |
| 119 | K::BulkOwnerGitLab, |
| 120 | K::BulkOwnerForgejo, |
| 121 | K::BulkListButton, |
| 122 | K::BulkSelectHeading, |
| 123 | K::BulkSelectAll, |
| 124 | K::BulkImportSelected, |
| 125 | K::BulkNone, |
| 126 | K::BulkPrivate, |
| 127 | K::BulkFork, |
| 128 | K::BulkArchived, |
| 129 | K::JobsTitle, |
| 130 | K::NoJobs, |
| 131 | K::JobQueued, |
| 132 | K::JobRunning, |
| 133 | K::JobDone, |
| 134 | K::JobFailed, |
| 135 | K::JobRetry, |
| 136 | K::JobOpenRepo, |
| 137 | K::JobProgress, |
| 138 | K::JobNoLog, |
| 139 | K::JobStarted, |
| 140 | K::RetryFailedTitle, |
| 141 | K::RetrySelected, |
| 142 | K::RetryNone, |
| 143 | K::StageGit, |
| 144 | K::StageLabels, |
| 145 | K::StageMilestones, |
| 146 | K::StageIssues, |
| 147 | K::StageReleases, |
| 148 | K::StageDone, |
| 149 | K::ErrBadRemote, |
| 150 | K::ErrBadInstance, |
| 151 | K::ErrBadOwner, |
| 152 | K::ErrNothingSelected, |
| 153 | K::ErrTooMany, |
| 154 | K::SettingsExport, |
| 155 | K::ExportTitle, |
| 156 | K::ExportRequest, |
| 157 | K::ExportBuilding, |
| 158 | K::ExportReady, |
| 159 | K::ExportFailed, |
| 160 | K::ExportDownload, |
| 161 | K::ExportNone, |
| 162 | K::ExportRequested, |
| 163 | K::ExportSize, |
| 164 | ]; |
| 165 | |
| 166 | /// `(English, Turkish)` for each phrase. |
| 167 | fn pair(key: K) -> (&'static str, &'static str) { |
| 168 | match key { |
| 169 | K::TabCreate => ("Create", "Oluştur"), |
| 170 | K::TabImport => ("Import", "İçe aktar"), |
| 171 | K::ImportTitle => ("Import a repository", "Depo içe aktar"), |
| 172 | K::SrcGit => ("Git URL", "Git URL'si"), |
| 173 | K::SrcGitHub => ("GitHub", "GitHub"), |
| 174 | K::SrcGitLab => ("GitLab", "GitLab"), |
| 175 | K::SrcForgejo => ("Forgejo / Gitea", "Forgejo / Gitea"), |
| 176 | K::GitUrl => ("Repository URL", "Depo URL'si"), |
| 177 | K::GitUser => ("Username (optional)", "Kullanıcı adı (isteğe bağlı)"), |
| 178 | K::GitPassword => ( |
| 179 | "Password or token (optional)", |
| 180 | "Parola veya belirteç (isteğe bağlı)", |
| 181 | ), |
| 182 | K::GitHubRepo => ("Repository (owner/name)", "Depo (sahip/ad)"), |
| 183 | K::GitLabInstance => ("GitLab address", "GitLab adresi"), |
| 184 | K::GitLabProject => ("Project path", "Proje yolu"), |
| 185 | K::ForgejoInstance => ( |
| 186 | "Forgejo or Gitea address (Codeberg works too)", |
| 187 | "Forgejo veya Gitea adresi (Codeberg da olur)", |
| 188 | ), |
| 189 | K::TokenOptional => ("Access token (optional)", "Erişim belirteci (isteğe bağlı)"), |
| 190 | K::TargetOwner => ("Owner", "Sahip"), |
| 191 | K::TargetName => ("New repository name", "Yeni depo adı"), |
| 192 | K::Description => ("Description (optional)", "Açıklama (isteğe bağlı)"), |
| 193 | K::WhatToImport => ("Also import", "Şunları da içe aktar"), |
| 194 | K::OptLabels => ("Labels and milestones", "Etiketler ve kilometre taşları"), |
| 195 | K::OptIssues => ("Issues and comments", "Konular ve yorumlar"), |
| 196 | K::OptPulls => ("Pull requests (as issues)", "Çekme istekleri (konu olarak)"), |
| 197 | K::OptReleases => ("Releases and their files", "Sürümler ve dosyaları"), |
| 198 | K::StartImport => ("Start import", "İçe aktarmayı başlat"), |
| 199 | K::BulkLink => ("Import several repositories", "Birden çok depoyu içe aktar"), |
| 200 | K::BulkLinkButton => ("Choose repositories", "Depoları seç"), |
| 201 | K::BulkTitle => ("Import several repositories", "Birden çok depoyu içe aktar"), |
| 202 | K::BulkOwnerGitHub => ( |
| 203 | "GitHub user or organization", |
| 204 | "GitHub kullanıcısı veya kuruluşu", |
| 205 | ), |
| 206 | K::BulkOwnerForgejo => ( |
| 207 | "User or organization (empty with a token lists your own)", |
| 208 | "Kullanıcı veya kuruluş (belirteçle boş bırakırsanız kendi depolarınız listelenir)", |
| 209 | ), |
| 210 | K::BulkOwnerGitLab => ("GitLab user or group", "GitLab kullanıcısı veya grubu"), |
| 211 | K::BulkListButton => ("List repositories", "Depoları listele"), |
| 212 | K::BulkSelectHeading => ( |
| 213 | "Select the repositories to import", |
| 214 | "İçe aktarılacak depoları seçin", |
| 215 | ), |
| 216 | K::BulkSelectAll => ("Select all", "Tümünü seç"), |
| 217 | K::BulkImportSelected => ("Import selected", "Seçilenleri içe aktar"), |
| 218 | K::BulkNone => ("No repositories found.", "Depo bulunamadı."), |
| 219 | K::BulkPrivate => ("private", "özel"), |
| 220 | K::BulkFork => ("fork", "çatal"), |
| 221 | K::BulkArchived => ("archived", "arşivlenmiş"), |
| 222 | K::JobsTitle => ("Import history", "İçe aktarma geçmişi"), |
| 223 | K::NoJobs => ("No imports yet.", "Henüz içe aktarma yok."), |
| 224 | K::JobQueued => ("Queued", "Sırada"), |
| 225 | K::JobRunning => ("Running", "Çalışıyor"), |
| 226 | K::JobDone => ("Done", "Bitti"), |
| 227 | K::JobFailed => ("Failed", "Başarısız"), |
| 228 | K::JobRetry => ("Retry", "Yeniden dene"), |
| 229 | K::JobOpenRepo => ("Open repository", "Depoyu aç"), |
| 230 | K::JobProgress => ("Progress", "İlerleme"), |
| 231 | K::JobNoLog => ("Nothing yet.", "Henüz bir şey yok."), |
| 232 | K::JobStarted => ("Started", "Başladı"), |
| 233 | K::RetryFailedTitle => ( |
| 234 | "Retry failed imports", |
| 235 | "Başarısız içe aktarmaları yeniden dene", |
| 236 | ), |
| 237 | K::RetrySelected => ("Retry selected", "Seçilenleri yeniden dene"), |
| 238 | K::RetryNone => ("No failed imports", "Başarısız içe aktarma yok"), |
| 239 | K::StageGit => ("Git data", "Git verisi"), |
| 240 | K::StageLabels => ("Labels", "Etiketler"), |
| 241 | K::StageMilestones => ("Milestones", "Kilometre taşları"), |
| 242 | K::StageIssues => ("Issues and pull requests", "Konular ve çekme istekleri"), |
| 243 | K::StageReleases => ("Releases", "Sürümler"), |
| 244 | K::StageDone => ("Finished", "Tamamlandı"), |
| 245 | K::ErrBadRemote => ( |
| 246 | "That repository address is not valid.", |
| 247 | "Bu depo adresi geçerli değil.", |
| 248 | ), |
| 249 | K::ErrBadInstance => ( |
| 250 | "That instance address is not valid.", |
| 251 | "Bu sunucu adresi geçerli değil.", |
| 252 | ), |
| 253 | K::ErrBadOwner => ( |
| 254 | "That user or organization name is not valid.", |
| 255 | "Bu kullanıcı veya kuruluş adı geçerli değil.", |
| 256 | ), |
| 257 | K::ErrNothingSelected => ("Select at least one repository.", "En az bir depo seçin."), |
| 258 | K::ErrTooMany => ( |
| 259 | "Too many repositories selected at once.", |
| 260 | "Bir seferde çok fazla depo seçildi.", |
| 261 | ), |
| 262 | K::SettingsExport => ("Data export", "Veri dışa aktarımı"), |
| 263 | K::ExportTitle => ("Export your data", "Verilerinizi dışa aktarın"), |
| 264 | K::ExportRequest => ("Request an export", "Dışa aktarım iste"), |
| 265 | K::ExportBuilding => ("Building", "Hazırlanıyor"), |
| 266 | K::ExportReady => ("Ready", "Hazır"), |
| 267 | K::ExportFailed => ("Failed", "Başarısız"), |
| 268 | K::ExportDownload => ("Download", "İndir"), |
| 269 | K::ExportNone => ("No exports yet.", "Henüz dışa aktarım yok."), |
| 270 | K::ExportRequested => ("Requested", "İstendi"), |
| 271 | K::ExportSize => ("Size", "Boyut"), |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | pub fn t(lang: Lang, key: K) -> &'static str { |
| 276 | let (en, tr) = pair(key); |
| 277 | match lang { |
| 278 | Lang::En => en, |
| 279 | Lang::Tr => tr, |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | /// The label before an export's expiry time, which follows as a relative time. |
| 284 | pub fn expires_label(lang: Lang) -> &'static str { |
| 285 | match lang { |
| 286 | Lang::En => "Expires", |
| 287 | Lang::Tr => "Son geçerlilik", |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | /// The import list's note after a bulk import left some repositories out. `list` says which and why. |
| 292 | pub fn bulk_skipped(lang: Lang, list: &str) -> String { |
| 293 | match lang { |
| 294 | Lang::En => format!("Not imported: {list}. Import them one by one to choose another name."), |
| 295 | Lang::Tr => format!( |
| 296 | "İçe aktarılmayanlar: {list}. Başka bir ad seçmek için onları tek tek içe aktarın." |
| 297 | ), |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | pub fn progress_of(done: i64, total: i64) -> String { |
| 302 | format!("{done} / {total}") |
| 303 | } |
| 304 | |
| 305 | #[cfg(test)] |
| 306 | mod tests { |
| 307 | use super::*; |
| 308 | |
| 309 | #[test] |
| 310 | fn every_variant_has_both_languages() { |
| 311 | for key in ALL { |
| 312 | assert!(!t(Lang::En, *key).is_empty(), "{key:?} has no English"); |
| 313 | assert!(!t(Lang::Tr, *key).is_empty(), "{key:?} has no Turkish"); |
| 314 | assert!( |
| 315 | !t(Lang::En, *key).contains('\u{2014}'), |
| 316 | "{key:?} has an em dash" |
| 317 | ); |
| 318 | assert!( |
| 319 | !t(Lang::Tr, *key).contains('\u{2014}'), |
| 320 | "{key:?} has an em dash" |
| 321 | ); |
| 322 | } |
| 323 | } |
| 324 | } |