yasinkuyu / localization Goto Github PK
View Code? Open in Web Editor NEW:fire: Create multi-language structure with ASP.NET MVC
License: MIT License
:fire: Create multi-language structure with ASP.NET MVC
License: MIT License
Öncelik çalışman çok güzel olmuş.
Aktif Dil Razor tarafında nasıl alabiliriz.
I have a big solution with multiple projects. The output are managed by two projects: an ASP MVC application and a WPF application.
There is a datamodel project shared between them with "DisplayLocalized" attribute in them. My problem is that when in the WPF application is instantiated any data model class, it throws a NullReferenceException on "ReadCookie" method because "HttpContext.Current" is null.
Can your return the original "id" like you do when there are no results for that "id"? That way it should not crash and since in WPF I don't use that attribute it doesn't matter.
I can do it myself but since I'm using your nuget package, it's a pain to deal with that because if there is an update in your package it will broke my project again.
First I want to thank you for this great plugin.
Is there a way to change the default language?
I don't really know where to put the DefaultLocale( ) method I could find in the Readme. I've installed the 1.0.7 version, then I upgraded it to 1.0.8 with nuget.
I have a controller which looks like this now:
`
public class LocalesController : Controller
{
public ActionResult Index(string lang = "hu_HU")
{
Response.Cookies["CacheLang"].Value = lang;
if (Request.UrlReferrer != null)
Response.Redirect(Request.UrlReferrer.ToString());
var message = Localization.Get("changedlng");
return Content(message);
}
}
`
But the default language for the site is still english.
Can you specify where to modify the code to set another default language?
Thank you very much!
I'm trying to create a migration, but an exception occurs...
The thing is that there is no HttpContext when run in a console command. And for some reason the migration tool wants to reads this attribute value. This makes the Localization to be initialized.
PM> Add-Migration Initialize
System.NullReferenceException: Object reference not set to an instance of an object.
at Insya.Localization.LocalizationStartup.GetLang(String id) in D:\DEV\PROJELER\InsyaCMS\Insya.Localization\src\LocalizationStartup.cs:line 37
at Insya.Localization.Attributes.DisplayLocalizeAttribute.get_DisplayName() in D:\DEV\PROJELER\InsyaCMS\Insya.Localization\src\Attributes\DisplayLocalizeAttribute.cs:line 38
at System.ComponentModel.DisplayNameAttribute.GetHashCode()
at System.Collections.Generic.ObjectEqualityComparer`1.GetHashCode(T obj)
at System.Linq.Set`1.InternalGetHashCode(TElement value)
at System.Linq.Set`1.Find(TElement value, Boolean add)
at System.Linq.Enumerable.<ExceptIterator>d__99`1.MoveNext()
at System.Linq.Enumerable.<OfTypeIterator>d__aa`1.MoveNext()
at System.Data.Entity.ModelConfiguration.Conventions.PropertyAttributeConfigurationConvention`1.<.ctor>b__0(ConventionTypeConfiguration ec)
at System.Data.Entity.ModelConfiguration.Conventions.TypeConvention.ApplyCore(Type memberInfo, ModelConfiguration modelConfiguration)
at System.Data.Entity.ModelConfiguration.Conventions.TypeConventionBase.Apply(Type memberInfo, ModelConfiguration modelConfiguration)
at System.Data.Entity.ModelConfiguration.Configuration.ConventionsConfiguration.ApplyModelConfiguration(Type type, ModelConfiguration modelConfiguration)
at System.Data.Entity.ModelConfiguration.Conventions.Convention.ApplyModelConfiguration(Type type, ModelConfiguration modelConfiguration)
at System.Data.Entity.ModelConfiguration.Configuration.ConventionsConfiguration.ApplyModelConfiguration(Type type, ModelConfiguration modelConfiguration)
at System.Data.Entity.ModelConfiguration.Mappers.TypeMapper.MapEntityType(Type type)
at System.Data.Entity.DbModelBuilder.<>c__DisplayClassd.<MapTypes>b__7(Type type)
at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
at System.Data.Entity.Utilities.IEnumerableExtensions.Each[T](IEnumerable`1 ts, Action`1 action)
at System.Data.Entity.DbModelBuilder.MapTypes(EdmModel model)
at System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo)
at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.LazyInternalContext.get_ModelBeingInitialized()
at System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx(DbContext context, XmlWriter writer)
at System.Data.Entity.Utilities.DbContextExtensions.<>c__DisplayClass1.<GetModel>b__0(XmlWriter w)
at System.Data.Entity.Utilities.DbContextExtensions.GetModel(Action`1 writeXml)
at System.Data.Entity.Utilities.DbContextExtensions.GetModel(DbContext context)
at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration, DbContext usersContext, DatabaseExistenceState existenceState, Boolean calledByCreateDatabase)
at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration)
at System.Data.Entity.Migrations.Design.MigrationScaffolder..ctor(DbMigrationsConfiguration migrationsConfiguration)
at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Run()
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
at System.Data.Entity.Migrations.Design.ToolingFacade.Scaffold(String migrationName, String language, String rootNamespace, Boolean ignoreChanges)
at System.Data.Entity.Migrations.AddMigrationCommand.Execute(String name, Boolean force, Boolean ignoreChanges)
at System.Data.Entity.Migrations.AddMigrationCommand.<>c__DisplayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
How and where i can change the defaut language ?
thanks!
I have a problem with default language. I deleted English and Turkish. I use other languages, but there is no initial cookie it crashes, because it want's en_EN.xml that I deleted. How to change this?
When I test locally, when I update some translations, after refresh everything works.
But when I get it on server, if I update something in .xml nothing happens, even if I delete that xml the content stays the same?
System.IO.FileNotFoundException:
WEB.UI\Localization\deger_DEGER.xml' dosyası bulunamadı.
varsayılan dile yönlendirebilir...
Hello.
Thank you for great nuget that help me.
But I'm try add ar = "" to inline code but not working
public class ARInline : Inline
{
public ARInline() { }
public ARInline(string ar = "", string en = ""){ }
public string ar_SA { get; set; }
}
regards.
Güzel bir çalışma eline sağlık. Oldukça yararlı fakat takıldığım bir nokta var Localization klasörü root a ekleniyor bu klasörün yolunu değiştirmeye yönelik bir ayar göremedim.Böyle bir planın var mı?
Null reference error when using comment tags () in the language XML files.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.