Reputation: 57
I've got a web page with a link, and the link is suppose to correspond to a PDF is the given user's language. I'm wondering where I should put these PDF files though. If I put them in App_LocalResources, I can't specify a link to /App_LocalResources/TOS_en-US.pdf can I?
Upvotes: 3
Views: 276
Reputation: 25704
The PDF should definitely not be in the App_LocalResources folder. That folder is only for RESX files.
The PDF files can go anywhere else in your app. For example, a great place to put them would be in a ~/PDF folder. Then your links will have to be dynamically generated (similar to what Greg has shown):
string cultureSpecificFileName = String.Format("TOS_{0}.pdf", CultureInfo.CurrentCulture.Name);
However, there are some other things to consider:
CurrentCulture.TwoLetterISOLanguageName
and then the file name would be TOS_en.pdf.Upvotes: 1
Reputation: 8016
Does the PDF have to have the same file name for each of the different languages? If not, put them all into a directory and just store the path in your resources file.
Upvotes: 0
Reputation: 16680
I would store the filename somewhere with an argument in it (i.e. "TOS_{0}.pdf" ) and then just add the appropriate suffix in code:
string cultureSpecificFileName = string.Format("TOS_{0}.pdf", CultureInfo.CurrentCulture);
Upvotes: 0