VSTO localization and setting CurrentUICulture on the main thread - localization

I have VSTO Application level add-ins that need to show localized resources within the ribbon. I know best practices are to utilize the CurrentUICulture on the current thread for localiztion, but it seems that the main thread I have access to within my add-ins is shared among all other VSTO add-ins. I do not want to be a bad citizen and set this property on a shared main thread, and alternatively I am afraid that if I were to rely on this setting it could be changed without my knowledge. Is there any suitable workaround within VSTO or is the best practice to basically keep some static marker with the locale I need to use so I do not trounce on either Office OR other VSTO add-ins?

It is not clear what Office application you are talking about. Take a look at the How to: Localize Excel Solutions article in MSDN which describes to localize Office add-ins.

Related

ADX Support with MVC 5 and CRM 2013

We have an idea to use ADX with MVC 5 and CRM 2013.
Is it possible?
We are doing background research on this whether to use ADX or not.
We have used ASP.NET with ADX previously.
This will help take a decision and will save our time.
Appreciate help if anyone know about this.
Adx portal - http://www.adxstudio.com/products/adxstudio-portals/
ADX offers a great product with an impressive feature list. http://www.adxstudio.com/products/adxstudio-portals/portals-features/
Like any add-on, look to see if there is something it contains that you deem as being vital and valuable enough to justify. Additionally, does your team have the ability/time to create the end product with or without ADX?
This is an opinion based question and in my opinion, none of the features alone justify the price. Especially seeing that ASP.NET + NuGet pretty much covers most of these features already.
Adxstudio Portals delivers managed forms by rendering a form in an Adxstudio Portal based on a particular form or view customization defined on an entity in CRM. Within CRM, entities can be customized and forms and views can be modified or created depending on your requirements.
https://community.adxstudio.com/products/adxstudio-portals/users-guide/managed-forms/
and
https://community.adxstudio.com/products/adxstudio-portals/developers-guide/web-controls/crmentityformview/
Above is the main reason us to consider ADX Studio.
ADX Studio, offers a good tool set to the client that has an internal developing team that will pick it up after you finish to customize it. Basically you provide some page template and the user is able to mess around with the forms to have a tailored experience (this works well when you don't have any logic on the page, just set the page and you are ready to go). Anything that is not in this category is custom made, means that you need to code it, and you will lose all the additional ADX benefits (for what concerns the read/write to CRM). Consider that a CRM developer is not a full asp/mvc developer, so anything that is more complex than change some code behind in a page template will create you problems, also all the jscript on the adx pages needs to be tailored, and you will need developers that are knowing the current web development standards, from Bootstrap to a decent js framework. Personally I'm not a huge fan, but the built-in authentication and some other features are making it a viable product. Consider that to customize it you will need someone that knows responsive design and js.

ASP.NET MVC Configurable Static Text

I am currently working on a project that requires Static Text to be configurable(including labels, messages, and validation errors). I was wondering what the best approach would be. The app is being written using ASP.NET MVC and C# 3.5. I need all this static configurable text to be fed to the MVC project from a different project. I thought of using Global Resources, or using an XML file that would be loaded on application start. By the way, this is not about localization, also static text won't be configurable by the end-user.
You could use AppSettings and web.config as James answered. you could also store it in a database, with key value pair structure.
But you also need to get it from the configuration project to the ASP.Net MVC project. I would do it like this:
Create a service interface on the configuration project
use Enterprise Library Caching in the ASP.Net MVC project
Check if the value is cached
If not get it from the configuration and store it in the cache
I would probably make a separate project that contained a series of Resx files, these are pretty easy to work with and give you localization for free. This is where I would start and if you need to edit them on the fly through some admin tool then you could use something like Rick Strahl's data driven provider. This is probably a better approach then trying to come up with your own DB driven design.
I do agree that you probably need to clarify a bit of how and when the text will be editable.
Definitely stay away from the web.config and appsettings unless we are only talking about 1 or 2 lines of text. In general this is not a good idea for many of the reasons others have stated about app restarts and just general config bloat.
I would store it in the AppSettings section in the Web.Config file.
Localization is actually a decent way to handle this--it is solving the same problem, you'd just need to provide a single language file. Downside is that localization bits are not necessarily easily end-user editable. Which drives me to the fact that the real question to answer here is "how user editable is this information going to be?" If the answer is "frequently and easily" then you might want to make some sort of UI Snippets table in your database and handle it accordingly. Another decent option would be to use a custom configuration section and read/write to it using the configuration API. Also leaves open hand-editing XML files if need be.
I would use a XML file with a single load at the application startup

How to design a plugin architecture for ASP.NET with MVC Web application

Introduction:
Now I know this question could be very broad and it would be too hard to answer without me asking something specific. So All I ask is just some direction, or a brief high level explanation of a design, or maybe there is already some framework out there that could help me get started...I'm not sure.. I have never designed a plugin architecture before, so maybe there is some resource/example you could point me to on the web that would help me learn so that I may come up with my own solution.
Details of my question:
My intention is I would like to create a plug-in architecture for a new pet-project that I am building in ASP.NET MVC.
I would like to design it so that it has some sort of plug-in ability for all, or at least most, of the application's components.
The reason I would like to do this, is so that I may be able to do deployments with nearly zero down time. The idea is that when I want to deploy the latest version I would drop in the new DLLs into a specific folder, and the application would load up the new plug ins and that is it.
For exapmle, lets say I add a new "contacts" feature to my web application where users can search, add and delete contacts. I would like to be able to deploy that by way of plugins.
Is something like this even possible for Web Applications? Or am I just dreaming?
It's definitely possible.
You will need to define a pretty comprehensive interface that represents everything your plugins will have to do. You should approach it by differentiating what is "core" to your application, and where the extensibility points are. For example, where will the plugins be accessed? Will they be tabs on a page, or links in a sidebar? What properties does each plugin need to have in order to fit into the plugin container?
Generally, plugins are enumerated via reflection by looking for assemblies that implement the plugin interface.
Just for encouragement, we've done this with an enterprise product that provides a generic framework for "management" interfaces for web sites. Developers just need to drop in a plugin dll that builds specific property pages, and they show up in the management interface menu, all the navigation is taken care of, and their dll's just have to worry about their own domain logic.
There is always the dll-way where you define some interfaces that plugins follow.
But for web application, especially ASP.NET MVC, you need a controller, views and so. Probably these can be included in a dll file using prepared controller factory to handle that, but it would be hard to develop these plugins.
Some inspiration for code (or db) embedded content: Haacked about that
ASP.NET MVC version 2 will support areas, where you can put some parts of the application into different folders within the app. This way you can just upload some files and the app will recognize these new files. Read more there Haacked blog
PS: I found another person here on S.O. asking the same question as me:
Plug-in architecture for ASP.NET MVC It might be useful for someone researching the same topic.

Cross project issues in fogbugz?

Is there a way in Fogbugz to track cross project cases?
For example, we have a business logic dll that is used in both the winform client as the web client. There was a bug there that needed solving in this dll.
Is there a way to make it so that adding a case to the project of the dll would autoamatically add this to the depending projects?
No there isn't a way to do this. You could either create two cases (one in each project) and link them, or in the upcoming FogBugz 7, you could make a subcase. But the only alternative to do this automatically would be to write something which scanned for these using the API and auto created the linked case.
I think you may get more focussed answers at the Fogbugz Support Forum.

What advantages are the of using .resx localization for an ASP.NET MVC app?

There are a number of questions on this site related to how to access RESX files in an ASP.NET MVC application, and best practices of using them.
However after reading (for the first time I might add) the MSDN article on resources I'm left wondering if there are even any advantages of using RESX files since I'm not going to be using server controls. Theres all this talk of 'implicit' and 'explicit' localization but I'm not going to benefit from that with MVC.
Ultimately my application will need string resources for buttons and menu items and also much longer HTML items for longer miscellaneous content. I would like to use a CMS for the longer items becuase I'm pretty sure I don't want to go sticking them into an RESX file.
Are there any compelling reasons to use or not to use ASP.NET resources in a new application. I'm going to assume that any future MVC enhancements or RESX enhancements will work in harmony together, but for now I'm just getting a glorified IDictionary as far as I can see.
Should I proceed with RESX or look elsewhere? Should I even be considering a CMS for the kinds of resources that RESX is designed for?
Any lessons learned would be appreciated.
There are couple of advantages to the RESX infrastructure:
you don't have to load the proper per-language resources. Once the locale of the thread is established, the CLr takes care of finding the appropriate assembly and loading the resources.
it is easy to hand off the locale-specific resources for localizations to third-parties.
there is a default fallback mechanism for non-localized resources.
There is also one particular disadvantage to the RESX approach:
it is hard to support translation model where the users translate your resources for you.
I'd like to elaborate a bit about that last point. Take for example the Facebook translation model. Facebook has fairly simple way for people to provide and vote on translations of various resources. If these are stored in a database, it would be possible to use them after the proper editorial process without rebuilding and redeploying the application. With the RESX model, the resources assemblies will have to be rebuild and redeployed, which could have high enough cost depending on the deployment process.
Thus, before deciding what localization process to use, I would look at the decision of who is going to do the localization and what the deployment process for the localizaed resources would be after the main application is already deployed.
EDIT: I forgot to mention that these considerations are orthogonal to the ASP.NET framework choice (MVC or WebForms).
I'd say "yes", resx files are still a good option for new applications. I don't think ASP.NET MVC in particular changes anything about storing your strings.
What's great about using resources is
they're pretty easy to manage
localizing your site is a much easier task than without resources (and I stress much easier)
you can replace the resource store at any time because resources use the provider model. You can switch out resx files for db entries without changing the implementation of your site.
I recommend resource files for the "site strings" which are different than the large blocks of data you might edit on a frequent basis. So for a full recommendation, I'd say use resource files (resx to start) for buttons, labels, etc, and a CMS for the meaty content.
If you are going to use Resx and not use Server Controls as you are in MVC, why not extend the MVC Helper methods so you can create localised labels and text? Then simply call the text from resource in the helper method.
e.g.
'<%=Html.CultureLabel("ResouceId") %>'
or
'<%=Html.CultureButton("Name","ResouceId", HtmlButtonType.Button) %>'
Just a thought.
Also managing globalisation of a site is MUCH easier with resx for the text.

Resources