Can I specify which cultures to use when generating local resource files? - asp.net

I am working on a website that is English by default and optionally in Spanish. I am generating local resource files for each page with language appropriate content for various items.
So far to create my pair of resource files (default and Spanish) for each page, visual studio 2010 generates the first file like default.aspx.resx. I create the Spanish version manually by copying the default file and renaming to default.aspx.es.resx.
Is there a way to have visual studio generate both files for me? I can generate the default file, add controls to the page, and generate again and visual studio is smart to not blow away any work I've done in that file. I would like to be able to also update the Spanish resource file automatically.

There is no tool in Visual Studio (at least I haven't found one when researching the same request), and we dropped the idea of writing smart macros for that purpose that parse resx files and modify other based on changes.
There is, however, a decent free tool that supports creating and aligning resources: Zeta Resource Editor.
You can add files and entries on click, and editing resources is much nicer than in Visual Studio, in addition to quite a few other useful features.

Related

How to ignore certain LESS files in Web Essentials LESS compiling? (Bootstrap)

I've set up Web Essentials 2013 (in Visual Studio 2012) and loaded in the default Twitter Bootstrap LESS source files. Auto-build and minification is working perfectly, except Web Essentials quite overdoes the job. When I select "bootstrap.less", make a change and save it, Web Essentials creates a new "bootstrap.css" as well as a "bootstrap.min.css" with everything inside I need. But when I edit e.g. buttons.less, it creates a buttons.css (and buttons.min.css) too (with all the includes and mixins). Which means, in fact, I'll have nearly the same css files over and over again under different names.
Can I declare certain files to be ignored on save?
There is a convention in Web Essentials that if the name of your less file starts with an underscore (like _utils.less) it will not be compiled to css on save.
https://webessentials.uservoice.com/forums/140520-general/suggestions/3319359-don-t-compile-nested-less-files
Okay, I figured it out.
What I initially wanted was LESS compilation on build, Web Essentials was so kind to do this on save. To deactivate this, in Visual Studio 2012 head over to Tools -> Options -> Web Essentials -> LESS and deactivate "Generate CSS file on save".
According to the Visual Studio Extension page for Web Essentials, minification on build works not by now, but will on future releases. I have to delete the .min.css files by myself and create it again on every build as it seems. :(
Pro-tip for every dev:
If you use any framework, tools, extensions etc. and your new super-powers don't work as expected, don't blame the extension, shut up and do it yourself.
Although what #corvuscorax says is absolutely true what I do (if you don't like the idea of starting your file names with an underscore) is to create a folder starting with a #
This seems to stop webessentials from compiling your less.
Note that Visual Studio won't let you create a folder with a starting hash so you will have to create it using your Windows Explorer and then add it to your project via visual studio.
For ignoring only files, you can use underscore at the file name.
Web Essentials has an internal convention whereby files beginning with an underscore will not be saved to CSS.
This is actually quite useful. You don’t want your variables.less or mixins.less files being saved as variables.css or mixins.css. So in this case, name them _variables.less and _mixins.less. They will be compiled (and thus checked for correct syntax) but won’t take up space on disk or in source control as redundant CSS files.
https://medium.com/#brendaningram/web-essentials-not-saving-css-files-a450b8c2d23a
There is a way to keep your filenames and prevent WebEssentials from compiling your LESS at the same time. Create .weignore file with filenames or masks for ignored files as described in the docs.

Is there a convenient way in VS.NET 2010 to copy new resource file entries from default resx files to specific language resx files?

I can't imagine this hasn't been asked before somewhere because the demand seems obvious: when localizing an ASP.NET website in Visual Studio 2010, I use Resharper to move strings to resx-files in App_LocalResources, copy the default language resx file, rename it to a specific language file, and enter the translations.
However, whenever there are additions to the default language file (because the aspx file changes), I need to copy them manually to the resx file of the specific language.
I guess there is an easy way to do this, a tool, an add-on. Is there?
I've never found anything that was great and did everything i wanted, however I've used this in the past and was ok.
ZetaResourceEditor
Ive also used a web based editor, we had a need for the translators to access the resource files. I think one of my programmers had to fix a couple of bugs with it but might be a good start.
LavaBlast

How to stop renamed .inc to .asp includes files to be browseable from the internet

So, I have a ASP classic website. I had many includes files that were mostly static html, but still some script code. When they have a .inc extension Visual studio 2010 shows them as plain text. They do not show any syntax highlighting or intellisense. So I renamed them to .asp extensions. Now I've realized that the public and search bots can browse to those files and execute them directly.
Is there a way to stop this without needing to rename the files back to *.inc?
I don't want to name them back for several reasons.
The syntax highlighting makes code so much more readable
I don't want to risk any issues with version control from renaming, which I've had in the past
I just plain don't want to have to change 100+ pages that reference the includes
It's not entirely clear which way round you want the files to be named so I will try and cover both options.
If they are .asp and they are showing the code, it means IIS is not executing the ASP properly, check your file handlers (let me know which IIS version you are using and i'll get you instructions). VS 2010 doesn't support classic ASP very well, the colouring is poor and there is no code completion. Use VS 2008 if you have it or you can get an Eclipse plugin, or I recently found Sublime Text that supports Classic ASP and does a much better job of colouring the text that VS2010 does (or there's good ol' Dreamweaver if you have money to burn).
If all your files are .inc, you will need to tell IIS to execute *.inc with the ASP handler. This way if someone did browse to the files, they would be executed first and not show any asp code back to the browser (they'll probably error, but that's a different matter). Your IDEs won't recognise .inc as a Classic ASP extension, so you will have to add .inc as being VBScript to your IDE. Again, VS 2010 isn't great for Classic ASP, so when you've picked an IDE that is, let me know and I'll set some instructions on changing file associations within it.!
File Associations:
VS2010
Tools > Options > Text Editor > File Extension
Use a different editor like Notepad++ that allows you to manually set the language encoding.

How can I extract localized string resources for translation?

I have several Visual Studio 2008 projects (ASP.NET 3.5) with many local resource files for localization of strings found in specific ASP.NET pages. Some of them are grouped in folders, some are named based on the page they are localizing, etc.
For example, App_LocalResources folder has a list of .resx files matching ASPX pages, UserControls/App_LocalResources matching ASCX user controls, etc.
Now I need to translate the application to another language and I would like to send all those keys for translation to someone who doesn't have access to the Visual Studio projects.
I could always write a small console app which would recursively find all .resx files and combine them to one big custom XML file which I could then send for translation. Upon receiving the translated XML file, the console app would recreate all small .resx files.
This all isn't a problem, but there must be a better way. What would you suggest, how should I do it?
I'm currently adding .NET support to appTranslator to .NET. The tool helps you easily manage translations of your resources by letting translators work on a single localization project file and creating the satellite DLLs right-away from the translations. I'll let you know when it's ready.
Passolo will automatically extract the default resource strings from exe's and dll's to a "bundle" that you can pass to a translation firm.
We are doing this at my work and it seems to work quite well.
You can exclude/hide strings to translate, add comments for each string and have multiple languages in the same project/bundle.
=======================
This Visual Studio Add in helps extract individual strings to resource files (.resx)
http://resourcerefactoring.codeplex.com/
Resource Refactoring Tool provides developers an easy way to extract hard coded strings from the code to resource files.
Its says its only been developed for VS 2005/2008 but it will be updated for vs 2010 soon.
Write a shell script for extracting all files into an excel. After extracting into excel any can easily manipulate it easily or write a tool for converting resource files to excel.
For Reference:http://www.codeproject.com/Articles/20920/NET-Resource-File-to-Excel-File-Converter

Generate a Sandcastle help file for a website without the "Xml Documentation File" option

I am trying to generate a Sandcastle help file for a website. In the properties window for project, there aren't any options for creating the XML Documentation File required for Sandcastle.
The Build tab in the property pages only contains options for: Start Action, Build Solution Action, and Accessibility validation. I don't have any options for Output, or XML documentation file, like my other projects have.
The website I'm working with does not have an actual .proj file, which could be the problem. If this is the problem, what is the best way of creating one for a project that is under source control and being worked on by many people with minimal disruption?
This is using Visual Studio 2005 professional.
The problem with websites in VS2k5 is that, when they get compiled, the resulting dlls are a mess. No namespaces, weird names, etc.
If you truly want to generate a Sandcastle Help File, look at converting your website into a web application. You can definitely generate source code docs for that.
I haven't tried it yet, but you might want to try the following
Documenting Web Sites / Projects from Eric Woodruff's site. It gives the specifics on how it can be done.
Update: I did try it and it works for regular websites. The only issue I can see is
that the websites don't have namespaces. So when I run it I get a topic by
FolderName_WebPage Class format without any logical grouping. So it is alhpabetical by
folder and page name. Once you got the content created, you can edit the help file using
a helpcompiler / builder and group the topics as needed.

Resources