Improved I18N support:
* GamePageData now includes the selected language's code. * Added support for multiple fetches in one call to the Translator service.
This commit is contained in:
parent
c7949e41cc
commit
9a7bc03171
9 changed files with 316 additions and 50 deletions
legacyworlds-server-beans-simple/src/main/java/com/deepclone/lw/beans/empire
|
@ -79,19 +79,8 @@ public class EmpireDAOBean
|
|||
public GeneralInformation getInformation( int empireId )
|
||||
{
|
||||
String sql = "SELECT * FROM emp.general_information WHERE id = ?";
|
||||
RowMapper< GeneralInformation > mapper = new RowMapper< GeneralInformation >( ) {
|
||||
@Override
|
||||
public GeneralInformation mapRow( ResultSet rs , int rowNum )
|
||||
throws SQLException
|
||||
{
|
||||
String st = rs.getString( "status" );
|
||||
Character status = ( st == null ) ? null : st.charAt( 0 );
|
||||
return new GeneralInformation( status , rs.getString( "name" ) , rs.getString( "alliance" ) , rs
|
||||
.getLong( "cash" ) , rs.getLong( "game_time" ) , rs.getInt( "account_id" ) );
|
||||
}
|
||||
};
|
||||
try {
|
||||
return this.dTemplate.queryForObject( sql , mapper , empireId );
|
||||
return this.dTemplate.queryForObject( sql , new GeneralInformationRowMapper( ) , empireId );
|
||||
} catch ( EmptyResultDataAccessException e ) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ public class EmpireManagementBean
|
|||
|
||||
return new GamePageData( generalInformation.getName( ) , generalInformation.getStatus( ) ,
|
||||
generalInformation.getTag( ) , generalInformation.getCash( ) , generalInformation.getNextTick( ) ,
|
||||
planets , rlTime );
|
||||
planets , rlTime, generalInformation.getLanguage( ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package com.deepclone.lw.beans.empire;
|
||||
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
|
||||
import com.deepclone.lw.sqld.game.GeneralInformation;
|
||||
|
||||
|
||||
|
||||
class GeneralInformationRowMapper
|
||||
implements RowMapper< GeneralInformation >
|
||||
{
|
||||
|
||||
@Override
|
||||
public GeneralInformation mapRow( ResultSet rs , int rowNum )
|
||||
throws SQLException
|
||||
{
|
||||
GeneralInformation info = new GeneralInformation( );
|
||||
|
||||
info.setName( rs.getString( "name" ) );
|
||||
info.setTag( rs.getString( "alliance" ) );
|
||||
info.setCash( rs.getLong( "cash" ) );
|
||||
info.setLanguage( rs.getString( "language" ) );
|
||||
info.setNextTick( rs.getLong( "game_time" ) );
|
||||
info.setAccountId( rs.getInt( "account_id" ) );
|
||||
|
||||
String statusString = rs.getString( "status" );
|
||||
info.setStatus( rs.wasNull( ) ? null : statusString.charAt( 0 ) );
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue