移动端首页的待办和提交任务如下红框中的国际化如何设置?
task

移动端首页显示的这些块的内容是在java文件中实现的,因此要实现国际化,需要对相关的java文件进行设置

java文件实现国际化就java文件标准的,待办和提交所在的java文件是/BIZ/SA/task/logic/code/dsrc/TaskViewProcedure.java

具体设置如下:

1.创建不同语言的properties类型资源文件

如:中文的:taskViewProcedure_zh.properties

内容如下:

条未处理 = 条未处理
待办 = 待办
无 = 无
提交 = 提交

英文的:taskViewProcedure_enproperties
内容如下:

条未处理 = untreated
待办 = waiting
无 = no
提交 = submiting

在java文件同级创建包目录放资源文件,本例创建的是locals

properties

2./BIZ/SA/task/logic/code/dsrc/TaskViewProcedure.java中获取语言,读取对应的语言资源文件


	public static Map<String,String> getLanguageLabels(){
		//获取当前的语言
		  String language[] = ContextHelper.getOperator().getLanguage().split("_");
		  Locale locale = new Locale(language[0], language[1]);

		 //设置语言环境
		  String basename = "locals.taskViewProcedure";//语言资源文件的目录名和文件名(注意不要加后面的语言如_zh)的组合	      
		  ResourceBundle myResources = ResourceBundle.getBundle(basename,locale);//根据基名和语言环境加载对应的语言资源文件	    
	      
	      //加载资源文件后, 程序就可以调用ResourceBundle实例对象的 getString方法获取指定的资源信息名称所对应的值。
	      String untreated = myResources.getString("条未处理");	     
	      String waiting = myResources.getString("待办");
	      String no = myResources.getString("无");
	      String submiting = myResources.getString("提交");
	      
	      //把获取语言资源信息名称所对应的值放到map中
	      HashMap<String, String> result = new HashMap<String, String>();
	      result.put("untreated",untreated);
	      result.put("waiting",waiting);
	      result.put("no",no);
	      result.put("submiting",submiting);
	      
	      return result;      
	}

3.给需要国际化设置的地方赋值

修改/BIZ/SA/task/logic/code/dsrc/TaskViewProcedure.java中queryWaitMessage和querySubmitMessage方法的实现

如下修改的queryWaitMessage:

	public static Map<String, Object> queryWaitMessage() {
		//从map中获取语言资源信息名称所对应的值
		Map<String,String> labels = getLanguageLabels();
		HashMap<String, Object> params = new HashMap<String, Object>();
		params.put(
				"columns",
				"SA_Task,sAIActive,sAIID,sAIStatusID,sAIStatusName,sActive,sActivity,sActivityInTemplate,sActivityName,sActivityNames,sActualFinishTime,sActualStartTime,sCURL,sCatalogID,sCode,sContent,sCreateTime,sCreatorDeptID,sCreatorDeptName,sCreatorFID,sCreatorFName,sCreatorOgnID,sCreatorOgnName,sCreatorPersonID,sCreatorPersonName,sCreatorPosID,sCreatorPosName,sCustomerID,sCustomerName,sData1,sData2,sData3,sData4,sDistributeTime,sEBField51,sEBField52,sEBField53,sEBField54,sEDField21,sEDField22,sEDField23,sEDField24,sEIField41,sEIField42,sEIField43,sEIField44,sENField11,sENField12,sENField13,sENField14,sESField01,sESField02,sESField03,sESField04,sESField05,sESField06,sESField07,sESField08,sETField31,sETField32,sETField33,sETField34,sEURL,sEmergencyID,sEmergencyName,sExecuteMode,sExecuteMode2,sExecuteTime,sExecutorDeptID,sExecutorDeptName,sExecutorFID,sExecutorFName,sExecutorNames,sExecutorOgnID,sExecutorOgnName,sExecutorPersonID,sExecutorPersonName,sExecutorPosID,sExecutorPosName,sExpectFinishTime,sExpectStartTime,sFlowID,sFrontID,sHints,sImportanceID,sImportanceName,sKindID,sLastModifyTime,sLimitTime,sLock,sName,sParent,sPlanID,sPlanName,sPreemptMode,sProcess,sProcessName,sProcessTemplateID,sProcessTemplateID2,sProcessTemplateItemSequence,sProjectID,sProjectName,sRemark,sRemindMode,sResponsible,sSequence,sShortcut,sSourceID,sStatusID,sStatusName,sSummary,sTempPermissionID,sTypeID,sTypeName,sVariable,sWarningTime,sWithdraw,version");
		params.put("limit", 1);
		params.put("offset", 0);
		params.put("orderBy", "sCreateTime DESC");
		params.put("variables", new HashMap<String, Object>());
		String executor = ActionUtils.getRequestContext().getActionContext().getExecutor();
		if(Utils.isEmptyString(executor)) executor = "*";

		Table data = (Table) ActionUtils.invokeAction(
				"/SA/task/taskView/taskViewProcess", "mainActivity",
				"queryWaitTask2Action", executor, params);

		if (data.size() > 0) {
			HashMap<String, Object> result = new HashMap<String, Object>();
			Integer size = (Integer) data.getProperties().get(
					Table.PROP_DB_COUNT);
			if(size == null) size = 0;
			String subLabel = size + labels.get("untreated");
			Row row = data.iterator().next();
			result.put("fLabel", labels.get("waiting"));
			result.put("fSubLabel", subLabel);//TODO: how to i18n
			result.put("fContent", row.getString("sName"));
			result.put("fTag", "");
			result.put("fDate", row.getDateTime("sCreateTime"));
			result.put("fCount", size);
			result.put("fProcess", "/SA/task/taskView/taskViewProcess");
			result.put("fActivity", "mainActivity");
			result.put("fUrl", "$UI/SA/task/taskView/waitActivity.a");
			return result;
		}else{
			HashMap<String, Object> result = new HashMap<String, Object>();
			String subLabel = labels.get("no");
			result.put("fLabel", labels.get("waiting"));
			result.put("fSubLabel", subLabel);//TODO: how to i18n
			result.put("fContent", "");
			result.put("fTag", "");
			result.put("fDate", null);
			result.put("fCount", 0);
			result.put("fProcess", "/SA/task/taskView/taskViewProcess");
			result.put("fActivity", "mainActivity");
			result.put("fUrl", "$UI/SA/task/taskView/waitActivity.a");
			return result;
		}
	}

在修改平台默认带的文件时推荐用扩展空间修改,可以下载下面的SA_X资源解压放到BIZ下直接使用
SA_X