support for long transifex language codes (like xx_XX) and a bit more friendly options for other than english languages

This commit is contained in:
filux 2015-02-06 01:29:13 +01:00
parent 3728fff67b
commit f749576f6c
4 changed files with 37 additions and 33 deletions

View File

@ -47,8 +47,8 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
//modeinfos=list<ModeInfo> ();
activeInputLabel=NULL;
int leftLabelStart=50;
int leftColumnStart=leftLabelStart+280;
int leftLabelStart=100;
int leftColumnStart=leftLabelStart+300;
//int rightLabelStart=450;
//int rightColumnStart=rightLabelStart+280;
int buttonRowPos=50;
@ -108,7 +108,7 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
labelLang.setText(lang.getString("Language"));
listBoxLang.registerGraphicComponent(containerName,"listBoxLang");
listBoxLang.init(currentColumnStart, currentLine, 320);
listBoxLang.init(currentColumnStart, currentLine, 375);
vector<string> langResults;
// string data_path = getGameReadWritePath(GameConstants::path_data_CacheLookupKey);
@ -232,7 +232,7 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
labelHealthBars.setText(lang.getString("Healthbar"));
listBoxHealthBars.registerGraphicComponent(containerName,"lisBoxtHealthBars");
listBoxHealthBars.init(currentColumnStart ,currentLine, 300 );
listBoxHealthBars.init(currentColumnStart ,currentLine, 375);
listBoxHealthBars.pushBackItem(lang.getString("HealthbarsFactionDefault"));
listBoxHealthBars.pushBackItem(lang.getString("HealthbarsOff"));
listBoxHealthBars.pushBackItem(lang.getString("HealthbarsAlways"));
@ -332,11 +332,11 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
labelTransifexUserLabel.setText(lang.getString("TransifexUserName"));
labelTransifexPwdLabel.registerGraphicComponent(containerName,"labelTransifexPwdLabel");
labelTransifexPwdLabel.init(currentLabelStart + 250 ,currentLine);
labelTransifexPwdLabel.init(currentLabelStart + 260 ,currentLine);
labelTransifexPwdLabel.setText(lang.getString("TransifexPwd"));
labelTransifexI18NLabel.registerGraphicComponent(containerName,"labelTransifexI18NLabel");
labelTransifexI18NLabel.init(currentLabelStart + 500 ,currentLine);
labelTransifexI18NLabel.init(currentLabelStart + 520 ,currentLine);
labelTransifexI18NLabel.setText(lang.getString("TransifexI18N"));
currentLine-=lineOffset;
@ -344,32 +344,32 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
labelTransifexUser.registerGraphicComponent(containerName,"labelTransifexUser");
labelTransifexUser.init(currentLabelStart,currentLine);
labelTransifexUser.setEditable(true);
labelTransifexUser.setMaxEditWidth(30);
labelTransifexUser.setMaxEditRenderWidth(220);
labelTransifexUser.setMaxEditWidth(28);
labelTransifexUser.setMaxEditRenderWidth(250);
labelTransifexUser.setText(config.getString("TranslationGetURLUser","<none>"));
labelTransifexPwd.registerGraphicComponent(containerName,"labelTransifexPwd");
labelTransifexPwd.init(currentLabelStart + 250 ,currentLine);
labelTransifexPwd.init(currentLabelStart + 260 ,currentLine);
labelTransifexPwd.setIsPassword(true);
labelTransifexPwd.setEditable(true);
labelTransifexPwd.setMaxEditWidth(35);
labelTransifexPwd.setMaxEditRenderWidth(220);
labelTransifexPwd.setMaxEditWidth(28);
labelTransifexPwd.setMaxEditRenderWidth(250);
labelTransifexPwd.setText(config.getString("TranslationGetURLPassword",""));
labelTransifexI18N.registerGraphicComponent(containerName,"labelTransifexI18N");
labelTransifexI18N.init(currentLabelStart + 500 ,currentLine);
labelTransifexI18N.init(currentLabelStart + 520 ,currentLine);
labelTransifexI18N.setEditable(true);
labelTransifexI18N.setMaxEditWidth(3);
labelTransifexI18N.setMaxEditRenderWidth(40);
labelTransifexI18N.setMaxEditWidth(6);
labelTransifexI18N.setMaxEditRenderWidth(70);
labelTransifexI18N.setText(config.getString("TranslationGetURLLanguage","en"));
currentLine-=lineOffset;
buttonGetNewLanguageFiles.registerGraphicComponent(containerName,"buttonGetNewLanguageFiles");
buttonGetNewLanguageFiles.init(currentLabelStart+20, currentLine, 200);
buttonGetNewLanguageFiles.init(currentLabelStart, currentLine, 250);
buttonGetNewLanguageFiles.setText(lang.getString("TransifexGetLanguageFiles"));
buttonDeleteNewLanguageFiles.registerGraphicComponent(containerName,"buttonDeleteNewLanguageFiles");
buttonDeleteNewLanguageFiles.init(currentLabelStart + 250, currentLine, 200);
buttonDeleteNewLanguageFiles.init(currentLabelStart + 260, currentLine, 250);
buttonDeleteNewLanguageFiles.setText(lang.getString("TransifexDeleteLanguageFiles"));
setupTransifexUI();
@ -609,6 +609,8 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
if(labelTransifexI18N.getText() != "") {
Lang &lang= Lang::getInstance();
string language = lang.getLanguageFile(labelTransifexI18N.getText());
replaceAll(language,"(","");
replaceAll(language,")","");
if(language != "") {
bool foundFilesToDelete = false;
@ -853,6 +855,8 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
replaceAll(langName,"@","");
replaceAll(langName,"!","");
replaceAll(langName,"*","");
replaceAll(langName,"(","");
replaceAll(langName,")","");
langName = trim(langName);
replaceAll(langName," ","-");
}

View File

@ -49,8 +49,8 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
//modeinfos=list<ModeInfo> ();
::Shared::PlatformCommon::getFullscreenVideoModes(&modeInfos,!config.getBool("Windowed"));
int leftLabelStart=50;
int leftColumnStart=leftLabelStart+280;
int leftLabelStart=100;
int leftColumnStart=leftLabelStart+300;
//int rightLabelStart=450;
//int rightColumnStart=rightLabelStart+280;
int buttonRowPos=50;
@ -188,7 +188,7 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
labelSelectionType.setText(lang.getString("SelectionType"));
listBoxSelectionType.registerGraphicComponent(containerName,"listBoxSelectionType");
listBoxSelectionType.init(currentColumnStart, currentLine, 200);
listBoxSelectionType.init(currentColumnStart, currentLine, 250);
listBoxSelectionType.pushBackItem("SelectBuffer (nvidia)");
listBoxSelectionType.pushBackItem("ColorPicking (default)");
listBoxSelectionType.pushBackItem("FrustumPicking (bad)");
@ -208,7 +208,7 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
labelShadows.setText(lang.getString("Shadows"));
listBoxShadows.registerGraphicComponent(containerName,"listBoxShadows");
listBoxShadows.init(currentColumnStart, currentLine, 200);
listBoxShadows.init(currentColumnStart, currentLine, 250);
for(int i= 0; i<Renderer::sCount; ++i){
listBoxShadows.pushBackItem(lang.getString(Renderer::shadowsToStr(static_cast<Renderer::Shadows>(i))));
}
@ -369,11 +369,11 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
buttonAutoConfig.setText(lang.getString("AutoConfig"));
buttonAutoConfig.registerGraphicComponent(containerName,"buttonAutoConfig");
buttonAutoConfig.init(buttonStartPos+250, buttonRowPos, 125);
buttonAutoConfig.init(buttonStartPos+230, buttonRowPos, 175);
buttonVideoInfo.setText(lang.getString("VideoInfo"));
buttonVideoInfo.registerGraphicComponent(containerName,"buttonVideoInfo");
buttonVideoInfo.init(buttonStartPos+385, buttonRowPos, 125); // was 620
buttonVideoInfo.init(buttonStartPos+415, buttonRowPos, 175); // was 620
GraphicComponent::applyAllCustomProperties(containerName);
}

View File

@ -45,8 +45,8 @@ MenuStateOptionsNetwork::MenuStateOptionsNetwork(Program *program, MainMenu *mai
this->parentUI=parentUI;
this->console.setOnlyChatMessagesInStoredLines(false);
//modeinfos=list<ModeInfo> ();
int leftLabelStart=50;
int leftColumnStart=leftLabelStart+280;
int leftLabelStart=100;
int leftColumnStart=leftLabelStart+300;
//int rightLabelStart=450;
//int rightColumnStart=rightLabelStart+280;
int buttonRowPos=50;
@ -123,7 +123,7 @@ MenuStateOptionsNetwork::MenuStateOptionsNetwork(Program *program, MainMenu *mai
labelServerPortLabel.setText(lang.getString("ServerPort"));
listBoxServerPort.registerGraphicComponent(containerName,"listBoxPublishServerExternalPort");
listBoxServerPort.init(currentColumnStart, currentLine, 170);
listBoxServerPort.init(currentColumnStart, currentLine, 160);
string portListString = config.getString("PortList",intToStr(GameConstants::serverPort).c_str());
std::vector<std::string> portList;
@ -219,8 +219,8 @@ MenuStateOptionsNetwork::MenuStateOptionsNetwork(Program *program, MainMenu *mai
buttonOk.registerGraphicComponent(containerName,"buttonOk");
buttonOk.init(buttonStartPos, buttonRowPos, 100);
buttonOk.setText(lang.getString("Save"));
buttonReturn.setText(lang.getString("Return"));
buttonReturn.setText(lang.getString("Return"));
buttonReturn.registerGraphicComponent(containerName,"buttonAbort");
buttonReturn.init(buttonStartPos+110, buttonRowPos, 100);

View File

@ -45,8 +45,8 @@ MenuStateOptionsSound::MenuStateOptionsSound(Program *program, MainMenu *mainMen
Config &config= Config::getInstance();
this->console.setOnlyChatMessagesInStoredLines(false);
int leftLabelStart=50;
int leftColumnStart=leftLabelStart+280;
int leftLabelStart=100;
int leftColumnStart=leftLabelStart+300;
//int rightLabelStart=450;
//int rightColumnStart=rightLabelStart+280;
int buttonRowPos=50;
@ -103,11 +103,11 @@ MenuStateOptionsSound::MenuStateOptionsSound(Program *program, MainMenu *mainMen
//soundboxes
labelSoundFactory.registerGraphicComponent(containerName,"labelSoundFactory");
labelSoundFactory.init(currentLabelStart, currentLine);
labelSoundFactory.setText(lang.getString("SoundAndMusic"));
labelSoundFactory.setText(lang.getString("SoundAndMusic2"));
listBoxSoundFactory.registerGraphicComponent(containerName,"listBoxSoundFactory");
listBoxSoundFactory.init(currentColumnStart, currentLine, 100);
listBoxSoundFactory.pushBackItem("None");
listBoxSoundFactory.init(currentColumnStart, currentLine, 175);
listBoxSoundFactory.pushBackItem(lang.getString("None"));
listBoxSoundFactory.pushBackItem("OpenAL");
listBoxSoundFactory.setSelectedItem(config.getString("FactorySound"));
@ -198,10 +198,10 @@ void MenuStateOptionsSound::reloadUI() {
buttonNetworkSettings.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
buttonNetworkSettings.setText(lang.getString("Network"));
labelSoundFactory.setText(lang.getString("SoundAndMusic"));
labelSoundFactory.setText(lang.getString("SoundAndMusic2"));
std::vector<string> listboxData;
listboxData.push_back("None");
listboxData.push_back(lang.getString("None"));
listboxData.push_back("OpenAL");
listBoxSoundFactory.setItems(listboxData);