Comments (12)
It should generate an email template with all this messages. Can you make a breakpoint inside ForEachCulture?
A different thing is if all the messages are similar. This will require you to translate PoiBEmailMessage but this does not make sense for applications, only for modules that will be distributed (like Signum extensions)
from framework.
Olmo this is @roiez, from my private account,
I understand.
We have the body of PoiBEmail translated to all target languages.
What I am missing is the next step,
what should I do to accomplish the behavior of ResetPassword,
when you generate a new environment, you are requested to create a ResetPassword email in a number of languages, in our case, I need to have the same for PoiBEmail.
from framework.
The way this works is by using the build-in localization system in Signum.Framework that reads the .xml
files in Translations
folder of Signum.Entities
Signum.Entities.Extensions
or YourApp.Entities
.
You can also start the Translation
module of Signum.Extensions
to generate/synchronize this translations using bing/google and provide a UI for translators.
That said, if you assume that the right template text is in the source code you loose the posibility to change it in real time on LIVE environment. We have settled on letting the DB be responsible of the templates, not the source code, to avoid duplication.
In this case I'll go for generating the environment with simplified English-only templates.
from framework.
OK, I created xml translation files for each language and now I am able to generate messages in all target languages.
However I run into a new problem. I am creating my emails programmatically and the problem is that in spite of having translations loaded into database, the email view always shows an English message.
How do I make sure the culture of EmailOwner will be reflected in the email view?
from framework.
- The
EmailOwner
should points to a validCultureInfo
- You should have the
EmailOwner
in theTo
field as a QueryToken.
If still doesn't work, then is a bug :D
from framework.
I made sure EmailOwner points to a culture that is 100% translated and is present in the database, and the To field is populated by that EmailOwner, indeed there was a problem, now the correct translation IS being rendered, however I get an exception after the email is sent: "Type AccountEntity is not in the list of ImplementedBy: UserEntity -> EmailOwnerID_User".
My EmailOwner is Account:
public static Expression> EmailOwnerDataExpression = a => new EmailOwnerData { Owner = a.ToLite(), CultureInfo = CultureInfo.GetCultureInfo(a.Language).ToCultureInfoEntity(), DisplayName = a.UserName, Email = a.Email, }; [ExpressionField] public EmailOwnerData EmailOwnerData => EmailOwnerDataExpression.Evaluate(this);
P.S. Further more, I have a problem with non Latin languages, they look like this: "????????, ????."
from framework.
The ImplementedBy problem is in your Starter.cs. There is some OverrideAttributes that change the implementations for EmailMessageEntity.Recipients including UserEntity but not AccountEntity.
About the encoding, I've no idea, you'll need to debug it yourself why the emails are not sent with the right encoding. Could be a DB thing but most probably is n the SMTP part. If you don't find it we can take a look some evening or on Sunday.
from framework.
When I do this:
sb.Schema.Settings.FieldAttributes((EmailMessageEntity em) => em.Recipients.First().EmailOwner).Replace(new ImplementedByAttribute(typeof(UserEntity), typeof(AccountEntity)));
I get this error:
AccountEntity is already included in the Schema Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: AccountEntity is already included in the Schema Source Error: Line 44: if (schema.Tables.ContainsKey(t)) Line 45: throw new InvalidOperationException("{0} is already included in the Schema".FormatWith(t.TypeName())); Line 46: }; Line 47: } Line 48: Source File: C:\work\Projects\BackOffice\Framework\Signum.Engine\Schema\SchemaBuilder\SchemaBuilder.cs Line: 46 Stack Trace: [InvalidOperationException: AccountEntity is already included in the Schema] Signum.Engine.Maps.SchemaBuilder.<.ctor>b__3_2(Type t) in C:\work\Projects\BackOffice\Framework\Signum.Engine\Schema\SchemaBuilder\SchemaBuilder.cs:46 Signum.Entities.MixinDeclarations.Register(Type mainEntity, Type mixinEntity) in C:\work\Projects\BackOffice\Framework\Signum.Entities\MixinEntity.cs:75 Signum.Entities.MixinDeclarations.Register() in C:\work\Projects\BackOffice\Framework\Signum.Entities\MixinEntity.cs:61 BackOffice.Logic.Starter.Start(String connectionString) in C:\work\Projects\BackOffice\BackOffice.Logic\Starter.cs:121 BackOffice.Web.MvcApplication.Application_Start() in C:\work\Projects\BackOffice\BackOffice.Web\Global.asax.cs:152 [HttpException (0x80004005): AccountEntity is already included in the Schema] System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +544 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +186 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +343 [HttpException (0x80004005): AccountEntity is already included in the Schema] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +112 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +712
It appears that the basic mixing is responsible for this error:
MixinDeclarations.Register();
Removing it allows to override EmailMessageEntity.Recipients, but then I am loosing my createdby etc. fields.
from framework.
The MixinDeclarations.Register should happen at the very beginning of the Starter.Start method, looks like it's happening to late.
from framework.
Olmo thank you very much! This fixed the issue.
from framework.
Hi Olmo and the community,
after a long pause, we are back to emails. The problem we are experiencing is with translated emails as follows: the messages are always in English and the issue seems to lay with this code of the framework:
public static IEnumerable CreateEmailMessage(this ISystemEmail systemEmail) { if (systemEmail.UntypedEntity == null) throw new InvalidOperationException("Entity property not set on SystemEmail"); using (IsolationEntity.Override(systemEmail.UntypedEntity.TryIsolation())) { var systemEmailEntity = ToSystemEmailEntity(systemEmail.GetType()); var template = GetDefaultTemplate(systemEmailEntity); return EmailTemplateLogic.CreateEmailMessage(template.ToLite(), systemEmail.UntypedEntity, systemEmail); } }
There seems to be no mentioning of CulterInfo at the message level.
from framework.
Hi roiez,
Nice to see you back.
The culture info is selected from the recipients, determined in the template.
If you take a look to GetEmailMessageInternal in https://github.com/signumsoftware/extensions/blob/master/Signum.Engine.Extensions/Mailing/EmailTemplateRenderer.cs
from framework.
Related Issues (20)
- Closing a new empty entity in the UI fire a prompt for un-saved changes HOT 2
- How to use an extension components? HOT 7
- Importing the exprted xml menu. HOT 3
- Upgrade to .NET Core? HOT 7
- Test environment path HOT 3
- Where is the export tool bar to xml? HOT 1
- Mysql support and .net core HOT 5
- Bug Report code generation. HOT 1
- Change license to MIT HOT 15
- Does not Compile as Release with VS2019 HOT 4
- dotnet publish -c Release does not work with Dotnet SDK 3.0 Pre HOT 2
- EMail Message Create button is missing. HOT 1
- Can't find Load Project downloaded project zip HOT 19
- Receiving emails via smpt HOT 1
- Ability to disable prompt 'lose changes' HOT 5
- Translation Problem in Dasboard Tab view HOT 2
- Login Signum with AD HOT 7
- Key 'Signum.Entities.Rest.RestLogEntity' (string) not found on ItemsDictionary HOT 7
- How to use [CurrentEntity] to filter current entity HOT 11
- Problems with transactions HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from framework.