Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cached translation support for LibraryTypes and TagTypes. #163

Merged
merged 4 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions resources/lang/tr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"Posts": "Yazılar",
"Post": "Yazı",
"CMS": "İçerik Yönetim Sistemi",
"Tag": "Etiket",
"Tags": "Etiketler",
"publish": "yayınla",
"Title": "Başlık",
"Title & Content": "Başlık & İçerik",
"Content": "İçerik",
"Status": "Durum",
"Post Tags": "Yazı Etiketleri",
"Post Category": "Yazı Kategorisi",
"Password Protected": "Şifre Korumalı",
"Sticky Until": "Sabitlenmiş Son Tarih",
"Still Sticky": "Hâlâ Sabit",
"Sticky Only": "Sadece Sabit",
"Not Sticky": "Sabit Değil",
"Publish": "Yayınla",
"Future": "Gelecek",
"Draft": "Taslak",
"Auto draft": "Otomatik Taslak",
"Pending": "Beklemede",
"Private": "Özel",
"Trash": "Çöp Kutusu",
"Inherit": "Miras Al",
"Post Title": "Yazı Başlığı",
"Post Content": "Yazı İçeriği",
"SEO": "SEO",
"SEO Settings": "SEO Ayarları",
"Tags and Categories": "Etiketler ve Kategoriler",
"Tags and Categories Options": "Etiket ve Kategori Seçenekleri",
"Categories": "Kategoriler",
"visibility": "görünürlük",
"Visibility": "Görünürlük",
"Visibility Options": "Görünürlük Seçenekleri",
"status": "durum",
"Password": "Şifre",
"published at": "yayınlanma tarihi",
"Featured Image": "Öne Çıkan Görsel",
"Pages": "Sayfalar",
"Page": "Sayfa",
"Description": "Açıklama",
"Parent Page": "Üst Sayfa",
"Page Order": "Sayfa Sıralaması",
"Post Slug": "Yazı Bağlantısı",
"Write an excerpt for your post": "Yazınız için bir özet yazın",
"Show All posts in": "Tüm yazıları göster:",
"No posts found": "Gönderi bulunamadı",
"Faq": "SSS",
"FAQ": "SSS",
"FAQ Categories": "SSS Kategorileri",
"frequently asked questions": "sıkça sorulan sorular",
"FAQs": "SSS'lar",
"Question": "Soru",
"Answer": "Cevap",
"Clear": "Temizle",
"Showing Search result of": "Arama sonuçları gösteriliyor:",
"Related Posts": "İlgili Yazılar",
"upload": "yükle",
"url": "URL",
"featured image url": "öne çıkan görsel URL'si",
"Navigations": "Menüler",
"Navigation": "Menü",
"Select Post": "Yazı Seçin",
"Select Page": "Sayfa Seçin",
"Recent Post": "Son Yazı",
"Post link": "Yazı bağlantısı",
"Page link": "Sayfa bağlantısı",
"Library link": "Kütüphane bağlantısı",
"External link": "Dış bağlantı",
"Same tab": "Aynı sekme",
"New tab": "Yeni sekme",
"Target": "Hedef",
"Libraries": "Kütüphaneler",
"Image": "Görsel",
"File": "Dosya",
"Video": "Video",
"library": "kütüphane",
"created at": "oluşturulma tarihi",
"Show File": "Dosyayı Göster",
"Library Tags": "Kütüphane Etiketleri",
"Library Title": "Kütüphane Başlığı",
"Library Slug": "Kütüphane URL'i",
"Library Description": "Kütüphane Açıklaması",
"Library Categories": "Kütüphane Kategorileri",
"Library Type": "Kütüphane Türü",
"Library File": "Kütüphane Dosyası",
"file url": "dosya URL'si",
"Tag.Name": "Etiket Adı",
"Slug": "Adres",
"Type": "Tür",
"Handle": "İşleyici Adı",
"Open": "Aç",
"Library": "Kütüphane",
"item": "eleman",
"Item": "Eleman",
"Label": "Etiket",
"Items": "Elemanlar",
"Items count": "Eleman sayısı"
}
16 changes: 14 additions & 2 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,15 @@ public function libraryTypes(array $types): static
return $this;
}

private ?array $translatedLibraryTypes = null;

public function getLibraryTypes(): ?array
{
return $this->libraryTypes;
if ($this->translatedLibraryTypes === null && $this->libraryTypes && function_exists('__')) {
$this->translatedLibraryTypes = array_map('__', $this->libraryTypes);
}

return $this->translatedLibraryTypes ?? $this->libraryTypes;
}

public function tagTypes(array $types): static
Expand All @@ -271,9 +277,15 @@ public function tagTypes(array $types): static
return $this;
}

private ?array $translatedTagTypes = null;

public function getTagTypes(): ?array
{
return $this->tagTypes;
if ($this->translatedTagTypes === null && $this->tagTypes && function_exists('__')) {
$this->translatedTagTypes = array_map('__', $this->tagTypes);
}

return $this->translatedTagTypes ?? $this->tagTypes;
}

public function uriPrefix(array $prefix): static
Expand Down