I have an application that has two localization options at the moment through .resx files. I would like to allow other users to translate the website into their own languages as they desire.
1) Is there a way to do so?
2) Or do they have to create a .resx file through some kind of a .resx creator and send it to me so than I can add it to my project?
As asp.net compiles on the fly your web site, you can attach new resx later.
I like Resex as resx file editor because it allows to categorize the resources and help to find not translated strings.
Related
I'm a newbie with ASP.NET web applications. When I create an ASP.NET web app project, there's a file called resources.resx in the folder My Project. Working in my computer I can access this file and its content without any problem. But when I deploy the application I can't access this file. I've tried copying the file seperately, and the folder (My Project) seperately, with the file in it, but no luck. Is there a way to achieve this?
PS: I've read something about implicit localization and explicit localization but I'd like to know if it can be done this way.
It's embedded into your DLL when you build (compile). So you can't change it when it's deployed.
If you want to see it in your DLL, you'll have to use a tool like Reflector, dotPeek, etc.
You can read more on resources here, starting from the 'Compiling Resources into Assemblies' title (as you know how to use them by now).
Well my suggestion is to use global and local resources.
In production you'll have resx file stored in:
App_GlobalResources: available in all application
App_LocalResources: one for each folder you want resources.
They are XML files visibile and editable.
I use it to allow me to modify string localization resources without recompiling and deploying.
And you can also give a web interface to the end user to allow him to self translate and localize strings at runtime.
I have a .net project whose part of the functionality is xls transformation.
I now want to move that functionality away from the main project to a separate class library project.
I have no problems moving classes and accessing them, but part of the resources that I wanted to move were xslt files that define the transformations. Those files were originally located in the special asp.net folder: App_Data and then accessed using Server.MapPath(~/App_Data/XSLT/anXsltFile.xslt)
I wanted to move those files to that separate library as well, but not sure how to approach it, and how to access those files within the class library.
Perhaps embed the xslt files inside your class library and stream read them as necessary to perform your transforms
http://support.microsoft.com/kb/319292
How to embed a text file in a .NET assembly?
http://blogs.msdn.com/b/alexdan/archive/2007/12/19/loading-embedded-resources-in-c-using-getmanifestresourcestream.aspx
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/1d341eae-fed4-408c-8791-96e96a5fd99c/
I think a class library, unlike a web site project, should not have file resources. It should supply the functionality to the web site project which will host the files.
I personally consider both the class library and the xslt files to be resources of the web site. Lets say you want to use this same class in a different app or web site, with different xslt files.
It's bad for re-usability.
I suggest you to use string constant in Web.Config with the Server.MapPath path and use these to load the xslt files.
I hope it's helpful
if you mantain the xsltfiles on the app_data, you must use
httpcontext.current.server.mappath("...your path...")
if you move the xslt files to the assembly too, you must get the Assembly resource...
We have so, so many RESX files in our ASP.NET 3.5 web application (for localisation purposes) and it's making code changes very slow; every time it runs for the first time all the symbols are built for the re-compiled RESX files.
Ideally I'd like to store these files in an external assembly and create a ResourceProvider that acts as a bridge.
That way the RESX files won't be affected by each subsequent compilation of the web app.
I also don't want to reinvent the wheel; someone must have done this before - but I can't find anything on it!
Actually it looks like reading through this article is going to be a good bet:
http://msdn.microsoft.com/en-us/library/aa905797.aspx
But I'll still hold out in case someone has an example!!
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
Is there any options to editing the resources in the App_GlobalResources folder? Once compiled, the directory is not included as part of the precompiled folder.
I read online that the App_GlobalResources Resources are compiled into a DLL for easy access. However, I want the administrator to be able to update the content of these files. Is the only way to convert these GlobalResources .RESX into LocalResources?
I don't know of any way to edit the files "in place" once they're compiled - but why not just make your changes, precompile the web again, and then just deploying the App_GlobalResources.compiled and App_GlobalResources.dll separately to your website? That should update the global resource DLL and should achieve what you're looking for, I think.
Marc
You can create a custom small resource editor application, this will be separate from your main application.
The GlobalResource Editor application will open a form which shows Keys in the first column and values in another column.
You can compile this application and copy and paste the app_globalresource file to your main application.
This way you can also ask your customer to use this application and teach him to copy and paste the resource file after compilation.