Localization in SharePoint ASPX Pages

To add a text from a resource file into your SharePoint ASPX page you have to place this code where ever you want this text to places.

<%$Resources:MyResource, MyName%>

where:

– MyResource: is the resource file name.

-MyName: is the resource entry key.

Your resource files must be placed in this directory:

..\12\CONFIG\Resources\

all resource files in this directory are copied to the global resources for every web application when it’s creating.

if the webapplication already exists place the resources files in this directory:

C:\Inetpub\wwwroot\wss\VirtualDirectories\<port>\App_GlobalResources\

where <port> is the the web application port

Advertisements

6 Responses to Localization in SharePoint ASPX Pages

  1. gaurav dixit says:

    thanks for providing this helpful information, I have just one question around placing resource file for existing web application. Do i need to build applilcation and restart IIS each time I add a new resource file or update existing resource file.

    thanks,
    Gaurav Dixit

  2. amrox says:

    Yes, you have to reset IIS but no need to rebuild the application.

    Sometimes its working even if you didn’t restart the IIS. Its depending on catching technique.

  3. mehdi says:

    i have a problem in make a new language pack for sharepoint 2007
    i translate all existing resources on 12 folder, but some text like (welcome, My Site, Site Actions, Cancle{for buttons} and … )don’t translate yet.
    where can i find theme and translate to my langauge?
    please help me

  4. amrox says:

    Hello Mehdi.
    As I mentioned in the blog. you have to create a new web application to apply that changes in the resource files existing in (12\config\resources) to.
    to apply them only after iisreset change them in (C:\Inetpub\wwwroot\wss\VirtualDirectories\\App_GlobalResources\)

    Another thing. Some of the error messages and text depending on the .Net framework language and user environment language (but of course site actions is not one of them)
    I will check and back to you.

  5. lunar says:

    thanks for the post, it helped a lot.

    what if i have two resorce files

    MyResource
    MyResource.nl-NL

    what i can do in this case?

  6. amrox says:

    You just have to add the tag:

    as in the post.

    and place your two files in the folders discussed above.
    according to the site culture you will see the text.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: