Browse Source

Merge pull request #20181 from abpframework/GoogleTranslation

Add `GoogleTranslation` feature to Docs module.
pull/20198/head
maliming 2 years ago
committed by GitHub
parent
commit
9829382484
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 56
      modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20240707104226_Initial.Designer.cs
  2. 38
      modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20240707104226_Initial.cs
  3. 54
      modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/VoloDocsDbContextModelSnapshot.cs
  4. 5
      modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs
  5. 3
      modules/docs/app/VoloDocs.Web/appsettings.json
  6. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/ar.json
  7. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/cs.json
  8. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/de.json
  9. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/el.json
  10. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/en-GB.json
  11. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/en.json
  12. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/es.json
  13. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/fi.json
  14. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/fr.json
  15. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/hi.json
  16. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/hr.json
  17. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/hu.json
  18. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/is.json
  19. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/it.json
  20. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/nl.json
  21. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/pl-PL.json
  22. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/pt-BR.json
  23. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/ro-RO.json
  24. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/ru.json
  25. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/sk.json
  26. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/sl.json
  27. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/tr.json
  28. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/vi.json
  29. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/zh-Hans.json
  30. 3
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/zh-Hant.json
  31. 51
      modules/docs/src/Volo.Docs.Web/DocsWebGoogleTranslationOptions.cs
  32. 59
      modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml
  33. 25
      modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/index.css

56
modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20240214150418_Initial.Designer.cs → modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20240707104226_Initial.Designer.cs

@ -13,7 +13,7 @@ using VoloDocs.EntityFrameworkCore;
namespace Migrations
{
[DbContext(typeof(VoloDocsDbContext))]
[Migration("20240214150418_Initial")]
[Migration("20240707104226_Initial")]
partial class Initial
{
/// <inheritdoc />
@ -22,7 +22,7 @@ namespace Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("ProductVersion", "8.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
@ -262,6 +262,58 @@ namespace Migrations
b.ToTable("AbpSecurityLogs", (string)null);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentitySession", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ClientId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("Device")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("DeviceInfo")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("IpAddresses")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<DateTime?>("LastAccessed")
.HasColumnType("datetime2");
b.Property<string>("SessionId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<DateTime>("SignedIn")
.HasColumnType("datetime2");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<Guid>("UserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("Device");
b.HasIndex("SessionId");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpSessions", (string)null);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b =>
{
b.Property<Guid>("Id")

38
modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20240214150418_Initial.cs → modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20240707104226_Initial.cs

@ -170,6 +170,26 @@ namespace Migrations
table.PrimaryKey("PK_AbpSecurityLogs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpSessions",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
SessionId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
Device = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
DeviceInfo = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ClientId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
IpAddresses = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
SignedIn = table.Column<DateTime>(type: "datetime2", nullable: false),
LastAccessed = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpSessions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpSettingDefinitions",
columns: table => new
@ -573,6 +593,21 @@ namespace Migrations
table: "AbpSecurityLogs",
columns: new[] { "TenantId", "UserId" });
migrationBuilder.CreateIndex(
name: "IX_AbpSessions_Device",
table: "AbpSessions",
column: "Device");
migrationBuilder.CreateIndex(
name: "IX_AbpSessions_SessionId",
table: "AbpSessions",
column: "SessionId");
migrationBuilder.CreateIndex(
name: "IX_AbpSessions_TenantId_UserId",
table: "AbpSessions",
columns: new[] { "TenantId", "UserId" });
migrationBuilder.CreateIndex(
name: "IX_AbpSettingDefinitions_Name",
table: "AbpSettingDefinitions",
@ -654,6 +689,9 @@ namespace Migrations
migrationBuilder.DropTable(
name: "AbpSecurityLogs");
migrationBuilder.DropTable(
name: "AbpSessions");
migrationBuilder.DropTable(
name: "AbpSettingDefinitions");

54
modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/VoloDocsDbContextModelSnapshot.cs

@ -19,7 +19,7 @@ namespace Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("ProductVersion", "8.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
@ -259,6 +259,58 @@ namespace Migrations
b.ToTable("AbpSecurityLogs", (string)null);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentitySession", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ClientId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("Device")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("DeviceInfo")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("IpAddresses")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<DateTime?>("LastAccessed")
.HasColumnType("datetime2");
b.Property<string>("SessionId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<DateTime>("SignedIn")
.HasColumnType("datetime2");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<Guid>("UserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("Device");
b.HasIndex("SessionId");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpSessions", (string)null);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b =>
{
b.Property<Guid>("Id")

5
modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs

@ -163,6 +163,11 @@ namespace VoloDocs.Web
{
options.Conventions.AddPageRoute("/Error", "error/{statusCode}");
});
Configure<DocsWebGoogleTranslationOptions>(options =>
{
options.UseGoogleTranslation = true;
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

3
modules/docs/app/VoloDocs.Web/appsettings.json

@ -6,6 +6,9 @@
}
}
},
"Redis": {
"Configuration": "127.0.0.1"
},
"ConnectionString": "Server=localhost;Database=VoloDocs;Trusted_Connection=True;TrustServerCertificate=True",
"ElasticSearch": {
"Url": "http://localhost:9200"

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/ar.json

@ -37,6 +37,7 @@
"Preview": "معاينة",
"Search": "بحث",
"SearchResults": "نتائج البحث",
"SearchInTheAllDocuments": "البحث في جميع الوثائق"
"SearchInTheAllDocuments": "البحث في جميع الوثائق",
"GoogleTranslate": "ترجمة جوجل"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/cs.json

@ -37,6 +37,7 @@
"Preview": "náhled",
"Search": "Vyhledávání",
"SearchResults": "Výsledky vyhledávání",
"SearchInTheAllDocuments": "Hledejte ve všech dokumentech"
"SearchInTheAllDocuments": "Hledejte ve všech dokumentech",
"GoogleTranslate": "Přeložit do češtiny"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/de.json

@ -37,6 +37,7 @@
"Preview": "Vorschau",
"Search": "Suchen",
"SearchResults": "Suchergebnisse",
"SearchInTheAllDocuments": "Durchsuchen Sie alle Dokumente"
"SearchInTheAllDocuments": "Durchsuchen Sie alle Dokumente",
"GoogleTranslate": "Ins Deutsche übersetzen"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/el.json

@ -36,6 +36,7 @@
"Volo.Docs.Domain:010002": "Το Μικρό όνομα {ShortName} υπάρχει ήδη.",
"Preview": "προεπισκόπηση",
"Search": "Αναζήτηση",
"SearchResults": "Αποτελέσματα αναζήτησης"
"SearchResults": "Αποτελέσματα αναζήτησης",
"GoogleTranslate": "Μετάφραση στα ελληνικά"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/en-GB.json

@ -34,6 +34,7 @@
"NewExplanation": "Created in the last two weeks.",
"UpdatedExplanation": "Updated in the last two weeks.",
"Volo.Docs.Domain:010002": "ShortName {ShortName} already exists.",
"Preview": "preview"
"Preview": "preview",
"GoogleTranslate": "Google Translate"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/en.json

@ -40,6 +40,7 @@
"SearchInTheAllDocuments": "Search in the all documents",
"Next": "Next",
"Previous": "Previous",
"ProjectDeletionWarningMessage": "Project will be deleted."
"ProjectDeletionWarningMessage": "Project will be deleted.",
"GoogleTranslate": "Google Translate"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/es.json

@ -37,6 +37,7 @@
"Preview": "Previsualizar",
"Search": "Buscar",
"SearchResults": "Resultados de la búsqueda",
"SearchInTheAllDocuments": "Buscar en todos los documentos"
"SearchInTheAllDocuments": "Buscar en todos los documentos",
"GoogleTranslate": "Traducir con Google"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/fi.json

@ -37,6 +37,7 @@
"Preview": "esikatselu",
"Search": "Hae",
"SearchResults": "Hakutulokset",
"SearchInTheAllDocuments": "Hae kaikista asiakirjoista"
"SearchInTheAllDocuments": "Hae kaikista asiakirjoista",
"GoogleTranslate": "Google-käännös"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/fr.json

@ -37,6 +37,7 @@
"Preview": "Aperçu",
"Search": "Rechercher",
"SearchResults": "Résultats de recherche",
"SearchInTheAllDocuments": "Rechercher dans tous les documents"
"SearchInTheAllDocuments": "Rechercher dans tous les documents",
"GoogleTranslate": "Google Traduction"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/hi.json

@ -37,6 +37,7 @@
"Preview": "पूर्व दर्शन",
"Search": "खोज",
"SearchResults": "खोज परिणाम",
"SearchInTheAllDocuments": "सभी दस्तावेज़ों में खोजें"
"SearchInTheAllDocuments": "सभी दस्तावेज़ों में खोजें",
"GoogleTranslate": "गूगल अनुवाद"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/hr.json

@ -37,6 +37,7 @@
"Preview": "Pretpregled",
"Search": "Pretraga",
"SearchResults": "Rezultati pretrage",
"SearchInTheAllDocuments": "Traži u svim dokumentima"
"SearchInTheAllDocuments": "Traži u svim dokumentima",
"GoogleTranslate": "Google prevoditelj"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/hu.json

@ -37,6 +37,7 @@
"Preview": "előnézet",
"Search": "Keresés",
"SearchResults": "Keresési eredmények",
"SearchInTheAllDocuments": "Keressen az összes dokumentumban"
"SearchInTheAllDocuments": "Keressen az összes dokumentumban",
"GoogleTranslate": "Google Fordító"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/is.json

@ -37,6 +37,7 @@
"Preview": "forskoðun",
"Search": "Leit",
"SearchResults": "Leitar niðurstöður",
"SearchInTheAllDocuments": "Leitaðu í öllum skjölum"
"SearchInTheAllDocuments": "Leitaðu í öllum skjölum",
"GoogleTranslate": "Google þýðing"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/it.json

@ -37,6 +37,7 @@
"Preview": "anteprima",
"Search": "Ricerca",
"SearchResults": "Risultati della ricerca",
"SearchInTheAllDocuments": "Cerca in tutti i documenti"
"SearchInTheAllDocuments": "Cerca in tutti i documenti",
"GoogleTranslate": "Traduci con Google"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/nl.json

@ -37,6 +37,7 @@
"Preview": "voorbeeld",
"Search": "Zoeken",
"SearchResults": "Zoekresultaten",
"SearchInTheAllDocuments": "Zoek in alle documenten"
"SearchInTheAllDocuments": "Zoek in alle documenten",
"GoogleTranslate": "Google Vertalen"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/pl-PL.json

@ -37,6 +37,7 @@
"Preview": "zapowiedź",
"Search": "Szukaj",
"SearchResults": "Wyniki wyszukiwania",
"SearchInTheAllDocuments": "Szukaj we wszystkich dokumentach"
"SearchInTheAllDocuments": "Szukaj we wszystkich dokumentach",
"GoogleTranslate": "Tłumaczenie na polski"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/pt-BR.json

@ -37,6 +37,7 @@
"Preview": "Previsualizar",
"Search": "Procurar",
"SearchResults": "Procurar Resultados",
"SearchInTheAllDocuments": "Pesquise em todos os documentos"
"SearchInTheAllDocuments": "Pesquise em todos os documentos",
"GoogleTranslate": "Traduzir com Google"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/ro-RO.json

@ -37,6 +37,7 @@
"Preview": "previzualizare",
"Search": "Caută",
"SearchResults": "Rezultatele căutării",
"SearchInTheAllDocuments": "Căutați în toate documentele"
"SearchInTheAllDocuments": "Căutați în toate documentele",
"GoogleTranslate": "Traducere Google"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/ru.json

@ -37,6 +37,7 @@
"Preview": "предварительный просмотр",
"Search": "Поиск",
"SearchResults": "результаты поиска",
"SearchInTheAllDocuments": "Искать во всех документах"
"SearchInTheAllDocuments": "Искать во всех документах",
"GoogleTranslate": "Google Translate"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/sk.json

@ -37,6 +37,7 @@
"Preview": "náhľad",
"Search": "Vyhľadať",
"SearchResults": "Výsledky vyhľadávania",
"SearchInTheAllDocuments": "Vyhľadajte vo všetkých dokumentoch"
"SearchInTheAllDocuments": "Vyhľadajte vo všetkých dokumentoch",
"GoogleTranslate": "Google preklad"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/sl.json

@ -37,6 +37,7 @@
"Preview": "predogled",
"Search": "Iskanje",
"SearchResults": "Rezultati iskanja",
"SearchInTheAllDocuments": "Poiščite v vseh dokumentih"
"SearchInTheAllDocuments": "Poiščite v vseh dokumentih",
"GoogleTranslate": "Google prevajalnik"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/tr.json

@ -36,6 +36,7 @@
"Volo.Docs.Domain:010002": "ShortName {ShortName} zaten var.",
"Preview": "ön izleme",
"Search": "Arama",
"SearchResults": "Arama Sonuçları"
"SearchResults": "Arama Sonuçları",
"GoogleTranslate": "Google Çeviri"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/vi.json

@ -37,6 +37,7 @@
"Preview": "xem trước",
"Search": "Tìm kiếm",
"SearchResults": "kết quả tìm kiếm",
"SearchInTheAllDocuments": "Tìm kiếm trong tất cả các tài liệu"
"SearchInTheAllDocuments": "Tìm kiếm trong tất cả các tài liệu",
"GoogleTranslate": "Dịch Google"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/zh-Hans.json

@ -37,6 +37,7 @@
"Preview": "预览",
"Search": "搜索",
"SearchResults": "搜索结果",
"SearchInTheAllDocuments": "在所有文档中搜索"
"SearchInTheAllDocuments": "在所有文档中搜索",
"GoogleTranslate": "谷歌翻译"
}
}

3
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/zh-Hant.json

@ -37,6 +37,7 @@
"Preview": "預覽",
"Search": "搜索",
"SearchResults": "搜索結果",
"SearchInTheAllDocuments": "在所有文件中搜尋"
"SearchInTheAllDocuments": "在所有文件中搜尋",
"GoogleTranslate": "谷歌翻譯"
}
}

51
modules/docs/src/Volo.Docs.Web/DocsWebGoogleTranslationOptions.cs

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Globalization;
namespace Volo.Docs;
public class DocsWebGoogleTranslationOptions
{
public bool UseGoogleTranslation { get; set; }
/// <summary>
/// https://cloud.google.com/translate/docs/languages
/// </summary>
public List<string> IncludedLanguages { get; set; }
public Func<CultureInfo, string> GetCultureLanguageCode { get; set; }
public DocsWebGoogleTranslationOptions()
{
UseGoogleTranslation = false;
IncludedLanguages =
[
"en",
"tr",
"zh-CN",
"zh-TW",
"ar",
"cs",
"hu",
"hr",
"fi",
"fr",
"hi",
"it",
"pt",
"ru",
"sk",
"de",
"es"
];
GetCultureLanguageCode = culture =>
{
return culture.Name switch
{
"zh-Hans" => "zh-CN",
"zh-Hant" => "zh-TW",
_ => culture.TwoLetterISOLanguageName
};
};
}
}

59
modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml

@ -1,5 +1,12 @@
@page
@using System.Globalization
@using Microsoft.AspNetCore.Mvc.Localization
@using Microsoft.AspNetCore.Mvc.TagHelpers
@using Microsoft.Extensions.Options
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Blockquote
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid
@using Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using Volo.Abp.AspNetCore.Mvc.UI.Packages.Anchor
@using Volo.Abp.AspNetCore.Mvc.UI.Packages.Clipboard
@ -8,13 +15,14 @@
@using Volo.Abp.AspNetCore.Mvc.UI.Packages.Prismjs
@using Volo.Abp.AspNetCore.Mvc.UI.Theming
@using Volo.Docs
@using Volo.Docs.Areas.Documents.TagHelpers
@using Volo.Docs.Localization
@using Volo.Docs.Pages.Documents.Project
@using Volo.Docs.Pages.Documents.Shared.ErrorComponent
@using Volo.Docs.Pages.Shared.Components.Head
@inject IThemeManager ThemeManager
@inject IPageLayout PageLayout
@inject IHtmlLocalizer<DocsResource> L
@inject IOptions<DocsWebGoogleTranslationOptions> DocsWebOptions
@model IndexModel
@{
@ -36,7 +44,7 @@
}
@section scripts {
@if (Model.LoadSuccess)
{
<abp-script-bundle name="@typeof(IndexModel).FullName">
@ -50,6 +58,34 @@
<abp-script src="/Pages/Documents/Shared/Scripts/vs.js"/>
<abp-script src="/Pages/Documents/Project/index.js"/>
</abp-script-bundle>
if (DocsWebOptions.Value.UseGoogleTranslation)
{
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: '@DocsWebOptions.Value.GetCultureLanguageCode(CultureInfo.CurrentUICulture)',
autoDisplay: false,
disableAutoTranslation: true,
includedLanguages: '@string.Join(",", DocsWebOptions.Value.IncludedLanguages)',
layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL
}, 'google_translate_element');
}
abp.dom.onNodeAdded(function (args) {
if (args.$el.hasClass('goog-te-combo')) {
args.$el.removeClass('goog-te-combo').addClass('form-select');
$('#google_translate_select').append(args.$el);
var a = $('#google_translate_element').find('a');
var img = $('#google_translate_element').find('img');
if (a.length > 0 && img.length > 0) {
var alt = img.attr('alt');
a.removeClass().css('color', '#666').html(alt);
}
}
});
</script>
<script type="text/javascript" src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
}
}
else
{
@ -178,6 +214,17 @@
}
</div>
@if (DocsWebOptions.Value.UseGoogleTranslation)
{
<div class="docs-version mt-2 skiptranslate">
<span>@L["GoogleTranslate"]</span>
<div class="version-select">
<div class="input-group" id="google_translate_select"></div>
</div>
</div>
<div id="google_translate_element" class="mt-1 mb-2"></div>
}
<div class="docs-version">
<div class="version-select">
<div class="input-group align-items-center">
@ -341,7 +388,7 @@
var rowCount = count / maxCellCount + (count % maxCellCount > 0 ? 1 : 0);
var cellSize = 12 / (count > maxCellCount ? maxCellCount : count);
var latestCellSize = 12 / count - (rowCount - 1) * maxCellCount;
string BuildParameterDivClass(int index)
{
var row = index / maxCellCount;
@ -349,7 +396,7 @@
var currentCellSize = isLastRow ? latestCellSize : cellSize;
return $"col-12 col-lg-{currentCellSize} mb-lg-{(isLastRow ? "0" : "2")} {(index == count - 1 ? "" : "mb-2")}";
}
for (var i = 0; i < count; ++i)
{
var parameter = Model.DocumentPreferences.Parameters[i];
@ -391,11 +438,11 @@
</abp-alert>
}
@Html.Raw(Model.Document.Content)
@if (Model.DocumentNavigationsDto.HasValues)
{
<hr class="my-4"/>
<div class="row navigation">
<div class="col-6">
@if (Model.DocumentNavigationsDto.HasPrevious)

25
modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/index.css

@ -20,4 +20,29 @@
color: #0B1621;
}
body {
top: 0px !important;
}
.skiptranslate iframe {
display: none !important;
}
.google_translate_text {
color: #aaa;
font-family: var(--bs-body-font-family);
font-size: 10pt;
margin-left: 2px;
font-weight: 500;
}
.goog-te-gadget {
white-space: break-spaces !important;
}
.goog-te-combo:focus-visible {
border: 0px;
outline: none;
}
/*# sourceMappingURL=Index.css.map */

Loading…
Cancel
Save