mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
added web client localization
This commit is contained in:
parent
5a014b093c
commit
c0801e4f6d
@ -61,5 +61,12 @@ namespace MediaBrowser.Controller.Localization
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>IEnumerable{LocalizatonOption}.</returns>
|
/// <returns>IEnumerable{LocalizatonOption}.</returns>
|
||||||
IEnumerable<LocalizatonOption> GetLocalizationOptions();
|
IEnumerable<LocalizatonOption> GetLocalizationOptions();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the java script localization dictionary.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="culture">The culture.</param>
|
||||||
|
/// <returns>Dictionary{System.StringSystem.String}.</returns>
|
||||||
|
Dictionary<string, string> GetJavaScriptLocalizationDictionary(string culture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -257,8 +257,12 @@ namespace MediaBrowser.Server.Implementations.IO
|
|||||||
InternalBufferSize = 32767
|
InternalBufferSize = 32767
|
||||||
};
|
};
|
||||||
|
|
||||||
newWatcher.NotifyFilter = NotifyFilters.CreationTime | NotifyFilters.DirectoryName |
|
newWatcher.NotifyFilter = NotifyFilters.CreationTime |
|
||||||
NotifyFilters.FileName | NotifyFilters.LastWrite | NotifyFilters.Size;
|
NotifyFilters.DirectoryName |
|
||||||
|
NotifyFilters.FileName |
|
||||||
|
NotifyFilters.LastWrite |
|
||||||
|
NotifyFilters.Size |
|
||||||
|
NotifyFilters.Attributes;
|
||||||
|
|
||||||
newWatcher.Created += watcher_Changed;
|
newWatcher.Created += watcher_Changed;
|
||||||
newWatcher.Deleted += watcher_Changed;
|
newWatcher.Deleted += watcher_Changed;
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"SettingsSaved": "Settings saved.",
|
||||||
|
"AddUser": "Add User",
|
||||||
|
"Users": "Users",
|
||||||
|
"Delete": "Delete",
|
||||||
|
"Administrator": "Administrator",
|
||||||
|
"Password": "Password",
|
||||||
|
"CreatePassword": "Create Password",
|
||||||
|
"DeleteImage": "Delete Image",
|
||||||
|
"DeleteImageConfirmation": "Are you sure you wish to delete this image?",
|
||||||
|
"FileReadCancelled": "The file read has been cancelled.",
|
||||||
|
"FileNotFound": "File not found.",
|
||||||
|
"FileReadError": "An error occurred while reading the file.",
|
||||||
|
"DeleteUser": "Delete User",
|
||||||
|
"DeleteUserConfirmation": "Are you sure you wish to delete {0}?",
|
||||||
|
"PasswordResetHeader": "Password Reset",
|
||||||
|
"PasswordResetComplete": "The password has been reset.",
|
||||||
|
"PasswordResetConfirmation": "Are you sure you wish to reset the password?",
|
||||||
|
"PasswordSaved": "Password saved.",
|
||||||
|
"PasswordMatchError": "Password and password confirmation must match."
|
||||||
|
}
|
@ -1,3 +1,21 @@
|
|||||||
{
|
{
|
||||||
"LabelTest": "Text"
|
"SettingsSaved": "Settings saved.",
|
||||||
|
"AddUser": "Add User",
|
||||||
|
"Users": "Users",
|
||||||
|
"Delete": "Delete",
|
||||||
|
"Administrator": "Administrator",
|
||||||
|
"Password": "Password",
|
||||||
|
"CreatePassword": "Create Password",
|
||||||
|
"DeleteImage": "Delete Image",
|
||||||
|
"DeleteImageConfirmation": "Are you sure you wish to delete this image?",
|
||||||
|
"FileReadCancelled": "The file read has been cancelled.",
|
||||||
|
"FileNotFound": "File not found.",
|
||||||
|
"FileReadError": "An error occurred while reading the file.",
|
||||||
|
"DeleteUser": "Delete User",
|
||||||
|
"DeleteUserConfirmation": "Are you sure you wish to delete {0}?",
|
||||||
|
"PasswordResetHeader": "Password Reset",
|
||||||
|
"PasswordResetComplete": "The password has been reset.",
|
||||||
|
"PasswordResetConfirmation": "Are you sure you wish to reset the password?",
|
||||||
|
"PasswordSaved": "Password saved.",
|
||||||
|
"PasswordMatchError": "Password and password confirmation must match."
|
||||||
}
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"SettingsSaved": "Configura\u00e7\u00f5es guardadas.",
|
||||||
|
"AddUser": "Adicionar Utilizador",
|
||||||
|
"Users": "Utilizadores",
|
||||||
|
"Delete": "Apagar",
|
||||||
|
"Administrator": "Administrador",
|
||||||
|
"Password": "Senha",
|
||||||
|
"CreatePassword": "Criar Senha",
|
||||||
|
"DeleteImage": "Apagar Imagem",
|
||||||
|
"DeleteImageConfirmation": "Tem a certeza que pretende apagar a imagem?",
|
||||||
|
"FileReadCancelled": "The file read has been cancelled.",
|
||||||
|
"FileNotFound": "Ficheiro n\u00e3o encontrado",
|
||||||
|
"FileReadError": "Ocorreu um erro ao ler o ficheiro.",
|
||||||
|
"DeleteUser": "Apagar Utilizador",
|
||||||
|
"DeleteUserConfirmation": "Tem a certeza que pretende apagar {0}?",
|
||||||
|
"PasswordResetHeader": "Password Reset",
|
||||||
|
"PasswordResetComplete": "The password has been reset.",
|
||||||
|
"PasswordResetConfirmation": "Are you sure you wish to reset the password?",
|
||||||
|
"PasswordSaved": "Senha guardada.",
|
||||||
|
"PasswordMatchError": "Password and password confirmation must match."
|
||||||
|
}
|
@ -333,8 +333,12 @@ namespace MediaBrowser.Server.Implementations.Localization
|
|||||||
{
|
{
|
||||||
return new List<LocalizatonOption>
|
return new List<LocalizatonOption>
|
||||||
{
|
{
|
||||||
new LocalizatonOption{ Name="English (United States)", Value="en-us"}
|
new LocalizatonOption{ Name="English (United States)", Value="en-us"},
|
||||||
};
|
new LocalizatonOption{ Name="German", Value="de"},
|
||||||
|
new LocalizatonOption{ Name="Portuguese (Portugal)", Value="pt-PT"},
|
||||||
|
new LocalizatonOption{ Name="Russian", Value="ru"}
|
||||||
|
|
||||||
|
}.OrderBy(i => i.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string LocalizeDocument(string document, string culture, Func<string,string> tokenBuilder)
|
public string LocalizeDocument(string document, string culture, Func<string,string> tokenBuilder)
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"LabelExit": "Ende",
|
||||||
|
"LabelVisitCommunity": "Besuche die Community",
|
||||||
|
"LabelGithubWiki": "Github Wiki",
|
||||||
|
"LabelSwagger": "Swagger",
|
||||||
|
"LabelStandard": "Standard",
|
||||||
|
"LabelViewApiDocumentation": "Zeige Api Dokumentation",
|
||||||
|
"LabelBrowseLibrary": "Durchsuche Bibliothek",
|
||||||
|
"LabelConfigureMediaBrowser": "Konfiguriere Media Browser",
|
||||||
|
"LabelOpenLibraryViewer": "\u00d6ffne Bibliothekenansicht",
|
||||||
|
"LabelRestartServer": "Server neustarten",
|
||||||
|
"LabelShowLogWindow": "Zeige Log Fenster",
|
||||||
|
"LabelPrevious": "Vorheriges",
|
||||||
|
"LabelFinish": "Ende",
|
||||||
|
"LabelNext": "N\u00e4chstes",
|
||||||
|
"LabelYoureDone": "Du bist fertig!"
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"LabelExit": "Exit",
|
||||||
|
"LabelVisitCommunity": "Visit Community",
|
||||||
|
"LabelGithubWiki": "Github Wiki",
|
||||||
|
"LabelSwagger": "Swagger",
|
||||||
|
"LabelStandard": "Standard",
|
||||||
|
"LabelViewApiDocumentation": "View Api Documentation",
|
||||||
|
"LabelBrowseLibrary": "Browse Library",
|
||||||
|
"LabelConfigureMediaBrowser": "Configure Media Browser",
|
||||||
|
"LabelOpenLibraryViewer": "Open Library Viewer",
|
||||||
|
"LabelRestartServer": "Restart Server",
|
||||||
|
"LabelShowLogWindow": "Show Log Window",
|
||||||
|
"LabelPrevious": "Previous",
|
||||||
|
"LabelFinish": "Finish",
|
||||||
|
"LabelNext": "Next",
|
||||||
|
"LabelYoureDone": "You're Done!"
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"LabelExit": "Sair",
|
||||||
|
"LabelVisitCommunity": "Visitar a Comunidade",
|
||||||
|
"LabelGithubWiki": "Wiki Github",
|
||||||
|
"LabelSwagger": "Swagger",
|
||||||
|
"LabelStandard": "Padr\u00e3o",
|
||||||
|
"LabelViewApiDocumentation": "Ver Documenta\u00e7\u00e3o da API",
|
||||||
|
"LabelBrowseLibrary": "Navegar na Biblioteca",
|
||||||
|
"LabelConfigureMediaBrowser": "Configurar Media Browser",
|
||||||
|
"LabelOpenLibraryViewer": "Abrir Visualizador da Biblioteca",
|
||||||
|
"LabelRestartServer": "Reiniciar Servidor",
|
||||||
|
"LabelShowLogWindow": "Mostrar Janela de Log",
|
||||||
|
"LabelPrevious": "Anterior",
|
||||||
|
"LabelFinish": "Terminar",
|
||||||
|
"LabelNext": "Seguinte",
|
||||||
|
"LabelYoureDone": "Concluiu!"
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"LabelExit": "\u0412\u044b\u0445\u043e\u0434",
|
||||||
|
"LabelVisitCommunity": "\u041f\u043e\u0441\u0435\u0442\u0438\u0442\u044c \u0421\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e",
|
||||||
|
"LabelGithubWiki": "\u0412\u0438\u043a\u0438 \u043d\u0430 Github",
|
||||||
|
"LabelSwagger": "\u041e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0435",
|
||||||
|
"LabelStandard": "\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439",
|
||||||
|
"LabelViewApiDocumentation": "\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e API",
|
||||||
|
"LabelBrowseLibrary": "\u041e\u0431\u043e\u0437\u0440\u0435\u0432\u0430\u0442\u0435\u043b\u044c \u041c\u0435\u0434\u0438\u0430\u0442\u0435\u043a\u0438",
|
||||||
|
"LabelConfigureMediaBrowser": "\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Media Browser",
|
||||||
|
"LabelOpenLibraryViewer": "\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u041c\u0435\u0434\u0438\u0430\u0442\u0435\u043a\u0438",
|
||||||
|
"LabelRestartServer": "\u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440",
|
||||||
|
"LabelShowLogWindow": "\u041e\u043a\u043d\u043e \u0416\u0443\u0440\u043d\u0430\u043b\u0430",
|
||||||
|
"LabelPrevious": "\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435",
|
||||||
|
"LabelFinish": "\u0417\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c",
|
||||||
|
"LabelNext": "\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435",
|
||||||
|
"LabelYoureDone": "\u0412\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0438!"
|
||||||
|
}
|
@ -284,6 +284,12 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Localization\JavaScript\javascript.json" />
|
<EmbeddedResource Include="Localization\JavaScript\javascript.json" />
|
||||||
<EmbeddedResource Include="Localization\Server\server.json" />
|
<EmbeddedResource Include="Localization\Server\server.json" />
|
||||||
|
<EmbeddedResource Include="Localization\Server\de.json" />
|
||||||
|
<EmbeddedResource Include="Localization\Server\pt_PT.json" />
|
||||||
|
<EmbeddedResource Include="Localization\Server\ru.json" />
|
||||||
|
<EmbeddedResource Include="Localization\JavaScript\en_US.json" />
|
||||||
|
<EmbeddedResource Include="Localization\JavaScript\pt_PT.json" />
|
||||||
|
<EmbeddedResource Include="Localization\Server\en_US.json" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -7,6 +7,7 @@ using MediaBrowser.Controller.Localization;
|
|||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using MediaBrowser.Controller.Plugins;
|
using MediaBrowser.Controller.Plugins;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
|
using MediaBrowser.Model.Serialization;
|
||||||
using ServiceStack;
|
using ServiceStack;
|
||||||
using ServiceStack.Web;
|
using ServiceStack.Web;
|
||||||
using System;
|
using System;
|
||||||
@ -100,6 +101,7 @@ namespace MediaBrowser.WebDashboard.Api
|
|||||||
|
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
private readonly ILocalizationManager _localization;
|
private readonly ILocalizationManager _localization;
|
||||||
|
private readonly IJsonSerializer _jsonSerializer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="DashboardService" /> class.
|
/// Initializes a new instance of the <see cref="DashboardService" /> class.
|
||||||
@ -107,12 +109,13 @@ namespace MediaBrowser.WebDashboard.Api
|
|||||||
/// <param name="appHost">The app host.</param>
|
/// <param name="appHost">The app host.</param>
|
||||||
/// <param name="serverConfigurationManager">The server configuration manager.</param>
|
/// <param name="serverConfigurationManager">The server configuration manager.</param>
|
||||||
/// <param name="fileSystem">The file system.</param>
|
/// <param name="fileSystem">The file system.</param>
|
||||||
public DashboardService(IServerApplicationHost appHost, IServerConfigurationManager serverConfigurationManager, IFileSystem fileSystem, ILocalizationManager localization)
|
public DashboardService(IServerApplicationHost appHost, IServerConfigurationManager serverConfigurationManager, IFileSystem fileSystem, ILocalizationManager localization, IJsonSerializer jsonSerializer)
|
||||||
{
|
{
|
||||||
_appHost = appHost;
|
_appHost = appHost;
|
||||||
_serverConfigurationManager = serverConfigurationManager;
|
_serverConfigurationManager = serverConfigurationManager;
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_localization = localization;
|
_localization = localization;
|
||||||
|
_jsonSerializer = jsonSerializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -484,7 +487,7 @@ namespace MediaBrowser.WebDashboard.Api
|
|||||||
{
|
{
|
||||||
Logger.ErrorException("Error minifying javascript", ex);
|
Logger.ErrorException("Error minifying javascript", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
var bytes = Encoding.UTF8.GetBytes(js);
|
var bytes = Encoding.UTF8.GetBytes(js);
|
||||||
await memoryStream.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
|
await memoryStream.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
|
||||||
|
|
||||||
@ -524,6 +527,7 @@ namespace MediaBrowser.WebDashboard.Api
|
|||||||
"autoorganizelog.js",
|
"autoorganizelog.js",
|
||||||
"channels.js",
|
"channels.js",
|
||||||
"channelitems.js",
|
"channelitems.js",
|
||||||
|
"dashboardgeneral.js",
|
||||||
"dashboardinfo.js",
|
"dashboardinfo.js",
|
||||||
"dashboardpage.js",
|
"dashboardpage.js",
|
||||||
"directorybrowser.js",
|
"directorybrowser.js",
|
||||||
@ -619,7 +623,10 @@ namespace MediaBrowser.WebDashboard.Api
|
|||||||
|
|
||||||
private async Task AppendLocalization(Stream stream)
|
private async Task AppendLocalization(Stream stream)
|
||||||
{
|
{
|
||||||
|
var js = "window.localizationGlossary=" + _jsonSerializer.SerializeToString(_localization.GetJavaScriptLocalizationDictionary(GetLocalizationCulture()));
|
||||||
|
|
||||||
|
var bytes = Encoding.UTF8.GetBytes(js);
|
||||||
|
await stream.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -668,16 +675,16 @@ namespace MediaBrowser.WebDashboard.Api
|
|||||||
|
|
||||||
var css = builder.ToString();
|
var css = builder.ToString();
|
||||||
|
|
||||||
try
|
//try
|
||||||
{
|
//{
|
||||||
var result = new KristensenCssMinifier().Minify(builder.ToString(), false, Encoding.UTF8);
|
// var result = new KristensenCssMinifier().Minify(builder.ToString(), false, Encoding.UTF8);
|
||||||
|
|
||||||
//css = result.MinifiedContent;
|
// css = result.MinifiedContent;
|
||||||
}
|
//}
|
||||||
catch (Exception ex)
|
//catch (Exception ex)
|
||||||
{
|
//{
|
||||||
Logger.ErrorException("Error minifying css", ex);
|
// Logger.ErrorException("Error minifying css", ex);
|
||||||
}
|
//}
|
||||||
|
|
||||||
var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(css));
|
var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(css));
|
||||||
|
|
||||||
|
@ -224,6 +224,9 @@
|
|||||||
<Content Include="dashboard-ui\css\mediaplayer.css">
|
<Content Include="dashboard-ui\css\mediaplayer.css">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\dashboardgeneral.html">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\dashboardinfopage.html">
|
<Content Include="dashboard-ui\dashboardinfopage.html">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
@ -518,6 +521,9 @@
|
|||||||
<Content Include="dashboard-ui\scripts\contextmenu.js">
|
<Content Include="dashboard-ui\scripts\contextmenu.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\scripts\dashboardgeneral.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\scripts\dashboardinfo.js">
|
<Content Include="dashboard-ui\scripts\dashboardinfo.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user