⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 i18n.java

📁 struts 2 核心包 的源码 有错误是难免的
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   I18n.java

package org.apache.struts2.components;

import com.opensymphony.xwork2.LocaleProvider;
import com.opensymphony.xwork2.TextProviderFactory;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.util.LocalizedTextUtil;
import com.opensymphony.xwork2.util.ValueStack;
import java.io.Writer;
import java.util.*;
import org.apache.struts2.StrutsException;
import org.apache.struts2.dispatcher.Dispatcher;

// Referenced classes of package org.apache.struts2.components:
//			Component

public class I18n extends Component
{

	protected boolean pushed;
	protected String name;

	public I18n(ValueStack stack)
	{
		super(stack);
	}

	public boolean start(Writer writer)
	{
		boolean result = super.start(writer);
		try
		{
			String name = findString(this.name, "name", "Resource bundle name is required. Example: foo or foo_en");
			ResourceBundle bundle = (ResourceBundle)findValue((new StringBuilder()).append("texts('").append(name).append("')").toString());
			if (bundle == null)
				bundle = LocalizedTextUtil.findResourceBundle(name, (Locale)getStack().getContext().get("com.opensymphony.xwork2.ActionContext.locale"));
			if (bundle != null)
			{
				final Locale locale = (Locale)getStack().getContext().get("com.opensymphony.xwork2.ActionContext.locale");
				TextProviderFactory tpf = new TextProviderFactory();
				Dispatcher.getInstance().getContainer().inject(tpf);
				getStack().push(tpf.createInstance(bundle, new LocaleProvider() {

					final Locale val$locale;
					final I18n this$0;

					public Locale getLocale()
					{
						return locale;
					}

			
			{
				this$0 = I18n.this;
				locale = locale1;
				super();
			}
				}));
				pushed = true;
			}
		}
		catch (Exception e)
		{
			String msg = (new StringBuilder()).append("Could not find the bundle ").append(this.name).toString();
			throw new StrutsException(msg, e);
		}
		return result;
	}

	public boolean end(Writer writer, String body)
	{
		if (pushed)
			getStack().pop();
		return super.end(writer, body);
	}

	public void setName(String name)
	{
		this.name = name;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -