0
\$\begingroup\$

I tried this tutorial to localize my XNA Windows Phone game, but I can't find the LocalizedFontProcessor in the drop-down list. Why is the LocalizedFontProcessor missing in the drop-down list? What is wrong?

In this picture you can see that the LocalizedFontProcessor is missing in the drop-down list:

enter image description here

Is there another way to localize a Windows Phone game?

Edit: Here is my LocalizedFontProcessor class

namespace LocalizationPipeline
{
[ContentProcessor]
class LocalizedFontProcessor : ContentProcessor<LocalizedFontDescription,
                                                SpriteFontContent>
{
    /// <summary>
    /// Converts a font description into SpriteFont format.
    /// </summary>
    public override SpriteFontContent Process(LocalizedFontDescription input,
                                              ContentProcessorContext context)
    {
        // Scan each .resx file in turn.
        foreach (string resourceFile in input.ResourceFiles)
        {
            string absolutePath = Path.GetFullPath(resourceFile);

            // Make sure the .resx file really does exist.
            if (!File.Exists(absolutePath))
            {
                throw new InvalidContentException("Can't find " + absolutePath);
            }

            // Load the .resx data.
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.Load(absolutePath);

            // Scan each string from the .resx file.
            foreach (XmlNode xmlNode in xmlDocument.SelectNodes("root/data/value"))
            {
                string resourceString = xmlNode.InnerText;

                // Scan each character of the string.
                foreach (char usedCharacter in resourceString)
                {
                    input.Characters.Add(usedCharacter);
                }
            }

            // Mark that this font should be rebuilt if the resource file changes.
            context.AddDependency(absolutePath);
        }

        // After adding the necessary characters, we can use the built in
        // FontDescriptionProcessor to do the hard work of building the font for us.
        return context.Convert<FontDescription,
                               SpriteFontContent>(input, "FontDescriptionProcessor");
    }
}
}
\$\endgroup\$
3
  • \$\begingroup\$ It's good to keep separate topics in separate questions, but this question is really a comment on an answer to your previous post. This is why you shouldn't ask two questions in one; now the previous topic is confused and difficult to follow up on. \$\endgroup\$ Nov 27, 2013 at 18:32
  • \$\begingroup\$ I think that tutorial instructs you to create the LocalizedFontProcessor. (Subheading "To extend the FontDescriptionProcessor class") Have you completed that step? \$\endgroup\$ Nov 27, 2013 at 18:35
  • \$\begingroup\$ I added my LocalizedFontProcessor class. Why is the LocalizedFontProcessor missing in the drop-down list? I tried to add more references but it didn't helped. I can add the complete project if you want. \$\endgroup\$ Nov 27, 2013 at 22:05

1 Answer 1

1
\$\begingroup\$

Right click on your content project (LocalizationContent) in Solution Explorer. Select "Add Reference".

Add a reference to your pipeline project (LocalizationPipeline) to your content project.

Make sure the pipeline project is built. Right click it and select build.

Your LocalizedFontProcessor should now show up in the Content Processor list.

(You might also have to make your LocalizedFontProcessor class public, I'm not sure. Also, you can give it a nice name by setting it in the attribute: [ContentProcessor(DisplayName = "My Localized Font Processor")].)

\$\endgroup\$
1
  • \$\begingroup\$ Thanx. It works. \$\endgroup\$ Nov 28, 2013 at 14:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .