From 4a9ecdc6ca17e7451ccfab0efc5b7b9f9927db3c Mon Sep 17 00:00:00 2001 From: A1Gard Date: Thu, 17 Oct 2024 04:43:27 +0330 Subject: [PATCH] translates update --- resources/js/panel/seo-analyzer.js | 83 +++++++++---------- resources/lang/fa.json | 48 ++++++++--- .../views/components/panel-footer.blade.php | 1 + .../views/components/translates.blade.php | 29 +++++++ 4 files changed, 108 insertions(+), 53 deletions(-) create mode 100644 resources/views/components/translates.blade.php diff --git a/resources/js/panel/seo-analyzer.js b/resources/js/panel/seo-analyzer.js index d90eb25..c24dce6 100644 --- a/resources/js/panel/seo-analyzer.js +++ b/resources/js/panel/seo-analyzer.js @@ -99,28 +99,26 @@ class ContentSEOAnalyzer { // Adjust the readability analysis to be more accurate with the new sentence detection analyzeReadability() { - const sentences = this.getSentences(); - const avgSentenceLength = sentences.length ? - this.wordCount / sentences.length : 0; + const avgSentenceLength = this.sentences.length ? + this.wordCount / this.sentences.length : 0; - // Calculate words per sentence more accurately - const sentenceLengths = sentences.map(sentence => - sentence.split(/\s+/).filter(word => word.length > 0).length - ); + const avgParagraphLength = this.paragraphs.length ? + this.wordCount / this.paragraphs.length : 0; + + // Increased threshold for complex sentences + const complexSentences = this.sentences.filter(sentence => + sentence.split(/\s+/).filter(word => word.length > 0).length > 25 + ).length; - // More accurate complex sentence detection - const complexSentences = sentenceLengths.filter(length => length > 25).length; - const complexSentencePercentage = sentences.length ? - (complexSentences / sentences.length) * 100 : 0; + const complexSentencePercentage = this.sentences.length ? + (complexSentences / this.sentences.length) * 100 : 0; return { avgSentenceLength, - avgWordsPerSentence: avgSentenceLength, - sentenceCount: sentences.length, + avgParagraphLength, complexSentencePercentage, - sentenceLengthVariation: this.calculateVariation(sentenceLengths), totalParagraphs: this.paragraphs.length, - readabilityScore: this.calculateReadabilityScore(sentenceLengths) + totalSentences: this.sentences.length }; } @@ -229,7 +227,7 @@ class ContentSEOAnalyzer { // 1. Content Length (2 points) if (this.wordCount >= 300) score += 2; - else feedback.push('Content is too short. Aim for at least 300 words.'); + else feedback.push(window.TR.contentShort); // 2. Keyword Usage (2 points) if (keywordAnalysis.density >= 0.5 && keywordAnalysis.density <= 2.5) score += 0.5; @@ -237,11 +235,11 @@ class ContentSEOAnalyzer { if (keywordAnalysis.headingsWithKeyword > 0) score += 1; if (keywordAnalysis.count >= 2) score += 0; - if (keywordAnalysis.density < 0.5) feedback.push('Keyword density is too low'); - if (keywordAnalysis.density > 3.5) feedback.push('Keyword density is too high'); - if (keywordAnalysis.shortKeyword) feedback.push('Keyword is too short fix keyword to better analyze'); - if (!keywordAnalysis.firstParagraphHasKeyword) feedback.push('Include keyword in the first paragraph'); - if (keywordAnalysis.headingsWithKeyword === 0) feedback.push('Include keyword in at least one heading'); + if (keywordAnalysis.density < 0.5) feedback.push(window.TR.destinyLow); + if (keywordAnalysis.density > 3.5) feedback.push(window.TR.destinyHigh); + if (keywordAnalysis.shortKeyword) feedback.push(window.TR.shortKeyword); + if (!keywordAnalysis.firstParagraphHasKeyword) feedback.push(window.TR.keywordFirstParagraph); + if (keywordAnalysis.headingsWithKeyword === 0) feedback.push(window.TR.keywordHeading); // 3. Readability (4 points) if (readabilityAnalysis.avgSentenceLength <= 30) score += 1; @@ -249,10 +247,10 @@ class ContentSEOAnalyzer { if (readabilityAnalysis.complexSentencePercentage <= 25) score += 1; if (this.paragraphs.length >= 3) score += 1; - if (readabilityAnalysis.avgSentenceLength > 30) feedback.push('Sentences are too long'); - if (readabilityAnalysis.avgParagraphLength > 150) feedback.push('Paragraphs are too long'); - if (readabilityAnalysis.complexSentencePercentage > 25) feedback.push('Too many complex sentences'); - if (this.paragraphs.length < 3) feedback.push('Add more paragraphs to improve structure'); + if (readabilityAnalysis.avgSentenceLength > 30) feedback.push(window.TR.sentencesLong); + if (readabilityAnalysis.avgParagraphLength > 150) feedback.push(window.TR.paragraphsLong); + if (readabilityAnalysis.complexSentencePercentage > 25) feedback.push(window.TR.sentencesComplex); + if (this.paragraphs.length < 3) feedback.push(window.TR.paragraphAdd); // 4. Structure & Formatting (2 points) const hasHeadings = /]*>/i.test(this.content); @@ -261,9 +259,10 @@ class ContentSEOAnalyzer { if (hasHeadings) score += 1; if (hasLists) score += 1; - if (!hasHeadings) feedback.push('Add headings to structure your content'); - if (!hasLists) feedback.push('Consider using lists to improve readability'); + if (!hasHeadings) feedback.push(window.TR.headingAdd ); + if (!hasLists) feedback.push(window.TR.useList); + console.log(readabilityAnalysis); return { score: Math.min(10, Math.round(score * 10) / 10), feedback, @@ -289,9 +288,9 @@ class ContentSEOAnalyzer { // Function to determine score status getScoreStatus(score) { - if (score >= 7) return { class: 'good', text: 'Good' }; - if (score >= 5) return { class: 'average', text: 'Needs Improvement' }; - return { class: 'poor', text: 'Poor' }; + if (score >= 7) return { class: 'good', text: window.TR.good }; + if (score >= 5) return { class: 'average', text: window.TR.averageNeeed }; + return { class: 'poor', text: window.TR.poor }; } // Function to create and display the report @@ -315,14 +314,14 @@ class ContentSEOAnalyzer {
-

SEO Score: ${scoreStatus.text}

-

Based on content analysis and keyword optimization

+

${ window.TR.SEOScore}: ${scoreStatus.text}

+

${window.TR.basedOnKeyword}

-

Recommendations

+

${window.TR.recommendations}

    ${report.feedback.map(item => `
  • ${item}
  • `).join('')}
@@ -330,30 +329,30 @@ class ContentSEOAnalyzer {
-

Content Length

-
${report.details.wordCount} words
+

${window.TR.contentLength}

+
${report.details.wordCount} ${ window.TR.words}
-

Keyword Usage

+

${window.TR.keywordUsage}

- ${report.details.keywordUsage.count} times + ${report.details.keywordUsage.count} ${ window.TR.times} (${report.details.keywordUsage.density})
-

Average Sentence Length

+

${window.TR.avgSenLen}

- ${report.details.readability.avgWordsPerSentence} words + ${report.details.readability.avgWordsPerSentence} ${ window.TR.words}
-

Paragraph Structure

+

${window.TR.avgParaStruc}

- ${report.details.readability.paragraphCount} paragraphs - (avg ${report.details.readability.avgWordsPerParagraph} words) + ${report.details.readability.paragraphCount} ${ window.TR.paragraphs} + (avg ${report.details.readability.avgWordsPerParagraph} ${ window.TR.words})
diff --git a/resources/lang/fa.json b/resources/lang/fa.json index d994f79..14c1207 100644 --- a/resources/lang/fa.json +++ b/resources/lang/fa.json @@ -25,6 +25,8 @@ "Add": "افزودن", "Add another one": "افزودن یک مورد دیگر", "Add cover to better results": "یک کاور جهت بهتر شدن نتایج اضافه کنید", + "Add headings to structure your content": "سر تیتر یا heading به محتوای خود اضافه کنید", + "Add more paragraphs to improve structure": "برای بهینه تر شدم بندهای بیشتری به نوشته خود اضافه کنید", "Add new adv": "افزودن یک تبلیغ", "Add new attachment": "افزودن یک پیوست", "Add new category": "افزودن یک دسته", @@ -93,9 +95,11 @@ "Auth code send successfully": "کد احراز هویت ارسال شد", "Authentication Mail": "ایمیل احراز هویت", "Avatar": "آواتار", + "Average Sentence Length": "میانگین طول جملات", "Back to profile": "بازگشت به نمایه", "Background image": "تصویر زمینه", "Base price": "مبلغ پایه", + "Based on content analysis and keyword optimization": "بر اساس تحلیل محتوا و بهینه سازی کلیدواژگان", "Basic data": "اطلاعات پایه", "Batch delete": "حذف چندگانه", "Batch restore": "بازیافت چندگانه", @@ -137,8 +141,11 @@ "Compare": "مقایسه", "Compare products": "مقایسه محصولات", "Confirm Password": "تایید گذرواژه", + "Consider using lists to improve readability": "استفاده از لیست ها را برای بهبود خوانایی در نظر بگیرید", "Contact us": "تماس با ما", "Contacts list": "فهرست تماس‌ها", + "Content Length": "طول محتوا", + "Content is too short. Aim for at least 300 words": "محتوا بسیار کوتاه است، برای نتیجه بهتر حداقل به ۳۰۰ واژه نیاز دارید", "Contents": "محتوا", "Continue": "ادامه", "Count": "تعداد", @@ -240,6 +247,7 @@ "Gallery": "گالری", "General": "عمومی", "Gfxes": "طراحی‌ها", + "Good": "خوب", "Graphic": "گرافیک", "Group": "سرفصل", "Group Parent": "والد سرفصل", @@ -265,6 +273,8 @@ "Image deleted successfully": "تصویر حذف شد", "Image uploaded successfully": "تصویر افزوده شد", "Images": "تصاویر", + "Include keyword in at least one heading": "حداقل یک مرتبه کلیدواژه را به عنوان اضافه کنید", + "Include keyword in the first paragraph": "کلیدواژه را در بند (پاراگراف) اول اضافه نمایید", "Increase \/ decrease by Admin": "افزودن \/ کاهش توسط مدیر سایت", "Increase by Admin removed:": "افزودنت توسط مدیر حذف شد", "Index": "صفحه نخست", @@ -284,6 +294,11 @@ "Is fillable": "قابل نمایش", "Item": "آیتم", "Key": "کلید", + "Keyword": "کلیدواژه کانونی", + "Keyword Usage": "استفاده از کلیدواژه", + "Keyword density is too high": "تراکم کلید واژه بسیار است", + "Keyword density is too low": "تراکم کلیدواژه کم است", + "Keyword is too short fix keyword to better analyze": "کلیدواژه بسیار کوتاه است، برای بررسی بهتر اصلاح نمایید", "Label": "برچسب", "Languages": "زبان‌ها", "Languages list": "فهرست زبان‌ها", @@ -321,12 +336,15 @@ "Name": "نام", "Name and lastname": "نام و نام‌خانوادگی", "Need process orders": "سفارشات نیازمند رسیدگی", + "Needs Improvement": "نیازمند بهینه‌تر شدن", "Next": "بعدی", "No parent": "بدون والد", "Not required": "غیر ضرروری", "Order removed successfully": "سفارش با موفقیت حذف شد", "Orders": "سفارشاات", "Orders count": "تعداد سفارش", + "Paragraph Structure": "ساختار بند", + "Paragraphs are too long": "بندها بسیار طولانی هستند", "Password": "گذرواژه", "Password or new password is:": "گذرواژه یا گذرواژه جدید عبارت است از:", "Pay now": "پرداخت", @@ -339,6 +357,7 @@ "Please confirm your password before continuing.": "لطفا پیش از ادامه گذرواژه خود را تایید کنید", "Please upload file": "لطفا یک پرونده بارگزاری کنید", "Please, Login or complete information to pay": "لطفا وارد شوید یا اطلاعات خود را تکمیل کنید تا اجازه پرداخت داشته باشید", + "Poor": "ضعیف", "Post": "نوشته", "Post Text": "متن نوشته", "Post code": "کد پستی", @@ -353,8 +372,8 @@ "Print": "چاپ", "Product": "محصول", "Product added to compare": "محصول به فهرست مقایسه افزوده شد", - "Product grid": "کاشی محصول", "Product added to favorites": "محصول به علاقه‌مندی شما افزوده شد", + "Product grid": "کاشی محصول", "Product removed from compare": "محصول از فهرست مقایسه حذف شد", "Product removed from favorites": "محصول از علاقه مندی های شما حذف شد", "Product table": "جدول محصول", @@ -376,10 +395,11 @@ "Questions list": "فهرست سوالات", "RTL": "راست به چپ", "Rate": "امتیاز", - "Rates list": "فهرست امتیازها", "Rates": "امتیازها", + "Rates list": "فهرست امتیازها", "Read more": "اطلاعات بیشتر", "Recent posts": "واپسین نوشته‌ها", + "Recommendations": "توصیه‌ها", "Recommends": "توصیه‌ها", "Register": "ثبت‌نام", "Register or Reset password": "ثبت‌نام یا بازیابی گذرواژه", @@ -399,6 +419,7 @@ "Role": "نقش", "Role filter": "صافی نقش‌ها", "SEO": "سئو", + "SEO Score": "امتیاز سئو", "SKU": "", "SMS": "پیامک", "Save": "ذخیره", @@ -406,7 +427,7 @@ "Search": "جستجو", "Search & Filter": "جستجو و صافی", "Search for": "جستجو برای", - "Search word is too short": "کلمه مورد جستجو بسیار کوتاه است", + "Search word is too short": "واژه مورد جستجو بسیار کوتاه است", "Searchable": "قابل جستجو", "Section": "بخش", "Sections": "بخش‌ها", @@ -418,6 +439,7 @@ "Send authenticate code": "ارسال کد احراز هویت", "Send ticket": "ارسال تیکت", "Sent to": "ارسال به", + "Sentences are too long": "جملات بسیار طولانی هستند", "Set": "تغییر به", "Setting": "تنظیمات", "Setting added to website": "تنظیم به سایت اضافه شد", @@ -436,8 +458,8 @@ "Signed out successfully": "با موفقیت خارج شدید", "Size": "اندازه", "Slider": "اسلایدر", - "Sliders": "اسلایدرها", "Slider data": "اطلاعات اسلایدر", + "Sliders": "اسلایدرها", "Sliders list": "فهرست اسلایدر", "Slug": "نامک", "Sort": "مرتب", @@ -478,6 +500,7 @@ "Toggle favorite": "تغییر وضعیت علاقه‌مندی", "Toggle navigation": "", "Toggle selection": "برعکس کردن انتخاب", + "Too many complex sentences": "جملات پیچیده بسیار هستند", "Total": "همه", "Total price": "مبلغ کل", "Tracking code": "کد پیگیری", @@ -562,21 +585,21 @@ "canonical": "کنونیکال", "category": "دسته‌بندی", "category_id": "دسته‌بندی", + "click here to request another": "برای ایجاد درخواست دیگر اینجا کلیک کنید", "code": "کد", "count": "تعداد", "country": "کشور", - "click here to request another": "برای ایجاد درخواست دیگر اینجا کلیک کنید", "created_at": "زمان ایجاد", "customer_id": "مشتری", "email": "رایانامه", "emoji": "ایموجی", "error in payment.": "خطا در پرداخت", "error in payment. contact admin.": "خطا در پرداخت با مدیر وبسایت تماس بگیرید", - "expire": "انقضا", "evaluation": "ارزیابی", "evaluation_id": "ارزیابی", - "group_id": "سرفصل", + "expire": "انقضا", "group": "سرفصل", + "group_id": "سرفصل", "hash": "هش", "icon": "نماد", "image": "تصویر", @@ -585,8 +608,8 @@ "is_default": "پیش فرض", "jpg": "", "label": "برچسب", - "loggable_type": "مورد ثبت", "loggable_id": "شماره ثبت", + "loggable_type": "مورد ثبت", "menu": "فهرست", "minute(s)": "دقیقه", "mobile": "موبایل", @@ -594,15 +617,16 @@ "news": "خبر", "not searchable": "غیرقابل جستجو", "one second ago": "یک ثانیه پیش", - "password repeat": "تکرار گذرواژه", + "paragraphs": "بند‌ها", "parent_id": "والد", + "password repeat": "تکرار گذرواژه", + "payment success": "پرداخت موفق بود", "pending": "معلق", "post": "نوشته", "price": "مبلغ", - "prop": "ویژگی", "product": "محصول", "product_id": "محصول", - "payment success": "پرداخت موفق بود", + "prop": "ویژگی", "rate": "امتیاز", "rateable_id": "مورد امتیاز", "rateable_type": " نوع امتیاز", @@ -617,6 +641,7 @@ "status": "وضعیت", "subject": "موضوع", "subtitle": "زیرعنوان", + "times": "مرتبه", "title": "عنوان", "total_price": "مبلغ کل", "transport": "حمل و نقل", @@ -624,6 +649,7 @@ "user_id": "کاربر", "view": "بازدید", "webp": "", + "words": "واژگان", "xShop": "", "yesterday": "دیروز" } diff --git a/resources/views/components/panel-footer.blade.php b/resources/views/components/panel-footer.blade.php index c1fd219..4f6415d 100644 --- a/resources/views/components/panel-footer.blade.php +++ b/resources/views/components/panel-footer.blade.php @@ -6,5 +6,6 @@ var website_font = "{{gfx()['font']}}"; window.routesList = @json(getAdminRoutes()); +@include('components.translates') diff --git a/resources/views/components/translates.blade.php b/resources/views/components/translates.blade.php new file mode 100644 index 0000000..0385774 --- /dev/null +++ b/resources/views/components/translates.blade.php @@ -0,0 +1,29 @@ +