Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added more germand translations, improved a few existing ones #186

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Usage

Development
----
Change the /src/main/resources/com/ardublock/block/ardublock_def.xml to add new blocks to ArduBlock
Change the /src/main/resources/com/ardublock/block/ardublock.xml to add new blocks to ArduBlock

$ mvn clean package

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.ardublock.translator.block.u8x2display;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.NumberBlock;
import com.ardublock.translator.block.TranslatorBlock;
import com.ardublock.translator.block.exception.BlockException;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;



public class ClearDisplayBlock extends TranslatorBlock
{
public ClearDisplayBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

public String toCode() throws SocketNullException, SubroutineNotDeclaredException
{

return "u8x8.clearDisplay();\n";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.ardublock.translator.block.u8x2display;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.NumberBlock;
import com.ardublock.translator.block.TranslatorBlock;
import com.ardublock.translator.block.exception.BlockException;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;



public class ClearLineBlock extends TranslatorBlock
{
public ClearLineBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

public String toCode() throws SocketNullException, SubroutineNotDeclaredException
{
TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
String row = translatorBlock.toCode();

return "u8x8.clearLine(" + row + ");\n";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.ardublock.translator.block.u8x2display;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.TranslatorBlock;

public class Draw2x2NumberBlock extends DrawNumberBlock
{
public Draw2x2NumberBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

protected String getCommand()
{
return "draw2x2String";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.ardublock.translator.block.u8x2display;

import com.ardublock.translator.Translator;

public class Draw2x2StringBlock extends DrawStringBlock
{
public Draw2x2StringBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

protected String getCommand()
{
return "draw2x2String";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.ardublock.translator.block.u8x2display;

import com.ardublock.translator.Translator;

public class Draw2x2UTF8Block extends DrawStringBlock
{
public Draw2x2UTF8Block(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

protected String getCommand()
{
return "draw2x2UTF8";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.ardublock.translator.block.u8x2display;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.NumberBlock;
import com.ardublock.translator.block.TranslatorBlock;
import com.ardublock.translator.block.exception.BlockException;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class DrawNumberBlock extends TranslatorBlock
{
public DrawNumberBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

public String toCode() throws SocketNullException, SubroutineNotDeclaredException
{
TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
String x = translatorBlock.toCode();
translatorBlock = this.getRequiredTranslatorBlockAtSocket(1);
String y = translatorBlock.toCode();
translatorBlock = this.getRequiredTranslatorBlockAtSocket(2);
String num = translatorBlock.toCode();
translator.addDefinitionCommand("char u8x8_number_buffer[30];");

return "itoa(" + num + ",u8x8_number_buffer,10);\nu8x8." + getCommand() + "(" + x + "," + y + ",u8x8_number_buffer);\n";
}

protected String getCommand()
{
return "drawString";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.ardublock.translator.block.u8x2display;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.NumberBlock;
import com.ardublock.translator.block.TranslatorBlock;
import com.ardublock.translator.block.exception.BlockException;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class DrawStringBlock extends TranslatorBlock
{
public DrawStringBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

public static String replace(String strSource, String strFrom, String strTo)
{
if (strSource == null) {
return null;
}
int i = 0;
if ((i = strSource.indexOf(strFrom, i)) >= 0) {
char[] cSrc = strSource.toCharArray();
char[] cTo = strTo.toCharArray();
int len = strFrom.length();
StringBuffer buf = new StringBuffer(cSrc.length);
buf.append(cSrc, 0, i).append(cTo);
i += len;
int j = i;
while ((i = strSource.indexOf(strFrom, i)) > 0) {
buf.append(cSrc, j, i - j).append(cTo);
i += len;
j = i;
}
buf.append(cSrc, j, cSrc.length - j);
return buf.toString();
}
return strSource;
}

public String toCode() throws SocketNullException, SubroutineNotDeclaredException
{
TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
String x = translatorBlock.toCode();
translatorBlock = this.getRequiredTranslatorBlockAtSocket(1);
String y = translatorBlock.toCode();
translatorBlock = this.getRequiredTranslatorBlockAtSocket(2);
String str = translatorBlock.toCode();
str = this.replace(str,"\\\\","\\");
str = this.replace(str,"\\\"","\"");

return "u8x8." + getCommand() + "(" + x + "," + y + "," + str + ");\n";
}

protected String getCommand()
{
return "drawString";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.ardublock.translator.block.u8x2display;

import com.ardublock.translator.Translator;

public class DrawUTF8Block extends DrawStringBlock
{
public DrawUTF8Block(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

protected String getCommand()
{
return "drawUTF8";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.ardublock.translator.block.u8x2display;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.NumberBlock;
import com.ardublock.translator.block.TranslatorBlock;
import com.ardublock.translator.block.exception.BlockException;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;



public class Oled96Inch128x64SSD1306I2CNONAMEHWBlock extends TranslatorBlock
{
public Oled96Inch128x64SSD1306I2CNONAMEHWBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

public String toCode() throws SocketNullException, SubroutineNotDeclaredException
{

translator.addHeaderFile("Arduino.h");
translator.addHeaderFile("U8x8lib.h");
translator.addDefinitionCommand("U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(U8X8_PIN_NONE);");
translator.addSetupCommand("u8x8.begin();");

return "";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.ardublock.translator.block.u8x2display;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.NumberBlock;
import com.ardublock.translator.block.TranslatorBlock;
import com.ardublock.translator.block.exception.BlockException;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;



public class SetFlipModeBlock extends TranslatorBlock
{
public SetFlipModeBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

public String toCode() throws SocketNullException, SubroutineNotDeclaredException
{
TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
String enable = translatorBlock.toCode();

return "u8x8.setFlipMode(" + enable + ");\n";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.ardublock.translator.block.u8x2display;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.NumberBlock;
import com.ardublock.translator.block.TranslatorBlock;
import com.ardublock.translator.block.exception.BlockException;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class SetFontBlock extends TranslatorBlock
{
public SetFontBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

public String toCode() throws SocketNullException, SubroutineNotDeclaredException
{
TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
String font = translatorBlock.toCode();

return "u8x8.setFont(" + font.replaceAll("\"","") + ");\n";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.ardublock.translator.block.u8x2display;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.NumberBlock;
import com.ardublock.translator.block.TranslatorBlock;
import com.ardublock.translator.block.exception.BlockException;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;



public class SetInverseFontBlock extends TranslatorBlock
{
public SetInverseFontBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

public String toCode() throws SocketNullException, SubroutineNotDeclaredException
{
TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
String enable = translatorBlock.toCode();

return "u8x8.setInverseFont(" + enable + ");\n";
}
}
23 changes: 23 additions & 0 deletions src/main/resources/com/ardublock/block/ardublock.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,7 @@ bg.DuinoEDU_IRREMOTE_NE_PAS_MEMORISER=No Mem
bg.DuinoEDU_IRREMOTE_MEMORISER_200_MS=200Ms Mem
bg.DuinoEDU_IRREMOTE_MEMORISER_2000_MS=20000Ms Mem
bg.DuinoEDU_infrared_compare=Key of Infrared
bg.DuinoEDU_infrared_compare.description=Key of Infrared
bc.DuinoEDU_Brightness=Brightness
bc.DuinoEDU_Display=Display
bg.DuinoEDU_On_digit1=1
Expand Down Expand Up @@ -1851,3 +1852,25 @@ bg.Midi_GS=G#
bg.Midi_A=A
bg.Midi_AS=A#
bg.Midi_B=B

bd.u8x2display=U8x2 Display
bg.u8x2display-oled-096inch-128x64-ssd1306-noname-hw-i2c=OLED 0.96 inch 128x64 SSD1306 NONAME HW I2C
bg.u8x2display-clear-display=Clear display
bg.u8x2display-clear-line=Clear line
bc.u8x2display-clear-line-row=Row
bg.u8x2display-set-flip-mode=Set flip mode
bc.u8x2display-set-flip-mode-enable=Enable
bg.u8x2display-set-inverse-font=Set inverse font
bc.u8x2display-set-inverse-font-enable=Enable
bg.u8x2display-set-font=Set font
bc.u8x2display-set-font-name=Name
bg.u8x2display-draw-string=Draw string
bc.u8x2display-draw-string-x=x position
bc.u8x2display-draw-string-y=y position
bc.u8x2display-draw-string-string=string
bg.u8x2display-draw-2x2-string=Draw 2x2 string
bg.u8x2display-draw-utf8=Draw UTF8 string
bg.u8x2display-draw-2x2-utf8=Draw 2x2 UTF8 string
bg.u8x2display-draw-number=Draw number
bc.u8x2display-draw-number-number=number
bg.u8x2display-draw-2x2-number=Draw 2x2 number
Loading