-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7376bc3
commit f49075d
Showing
12 changed files
with
131 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,26 +28,18 @@ public AboutAction(Component parent) { | |
*/ | ||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
Window ancestor = parent==null? null : SwingUtilities.getWindowAncestor(parent); | ||
JOptionPane.showMessageDialog( | ||
SwingUtilities.getWindowAncestor(parent), | ||
"<html><body>" | ||
+"<h1>"+RobotOverlord.APP_TITLE+" "+RobotOverlord.VERSION+"</h1>" | ||
+"<h3><a href='http://www.marginallyclever.com/'>http://www.marginallyclever.com/</a></h3>" | ||
+"<h4>Created by</h4>" | ||
+"<p>Dan Royer ([email protected]).</p>" | ||
+"<h4>Testers</h4>" | ||
+"<p>Omar al rafei (Arc robotics)</p>" | ||
+"<h4>More info</h4>" | ||
+"<p>To get the latest version please visit<br><a href='"+RobotOverlord.APP_URL+"'>"+RobotOverlord.APP_URL+"</a></p><br>" | ||
+"<p>This program is open source and free. If this was helpful<br> to you, please buy me a thank you beer through Paypal.</p>" | ||
+"</body></html>"); | ||
ancestor, | ||
Translator.get("AboutAction.message",RobotOverlord.VERSION)); | ||
} | ||
|
||
/** | ||
* | ||
* @param args ignored | ||
*/ | ||
public static void main(String[] args) { | ||
Translator.start(); | ||
new AboutAction(null).actionPerformed(null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...test/java/com/marginallyclever/robotoverlord/swing/translator/TranslationsUnusedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.marginallyclever.robotoverlord.swing.translator; | ||
|
||
import org.apache.commons.io.FilenameUtils; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.io.FileNotFoundException; | ||
import java.io.InputStream; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public class TranslationsUnusedTest { | ||
private InputStream getInputStream(String filename) throws FileNotFoundException { | ||
String nameInsideJar = Translator.LANGUAGES_DIRECTORY+"/"+ FilenameUtils.getName(filename); | ||
InputStream stream = Translator.class.getClassLoader().getResourceAsStream(nameInsideJar); | ||
String actualFilename = "Jar:"+nameInsideJar; | ||
File externalFile = new File(filename); | ||
if(externalFile.exists()) { | ||
stream = new FileInputStream(filename); | ||
actualFilename = filename; | ||
} | ||
if( stream == null ) throw new FileNotFoundException(actualFilename); | ||
return stream; | ||
} | ||
|
||
@Test | ||
public void findUnusedTranslations() throws Exception { | ||
TranslatorLanguage english = new TranslatorLanguage(); | ||
english.loadFromInputStream(getInputStream("target/classes/languages/english.xml")); | ||
Set<String> keys = english.getKeys(); | ||
Set<String> found = new HashSet<>(); | ||
|
||
TranslationsMissingTest search = new TranslationsMissingTest(); | ||
search.searchAllSourceFiles((e)->{ | ||
found.add(e.key); | ||
}); | ||
keys.removeAll(found); | ||
System.out.println("Unused translations:"); | ||
for(String key : keys) { | ||
System.out.println(key); | ||
} | ||
Assertions.assertEquals(0,keys.size(),"Unused translations found: "+ keys); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters