Skip to content

Commit

Permalink
#43: Dungeon localized, tr() added to Actor
Browse files Browse the repository at this point in the history
  • Loading branch information
Arcnor committed Oct 12, 2014
1 parent fafe0b4 commit 7aa1c59
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 45 deletions.
42 changes: 41 additions & 1 deletion android/assets/i18n/l10n.properties
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,44 @@ story_metropolis = Dwarven Metropolis was once the greatest of dwarven city-stat
story_halls = In the past these levels were the outskirts of Metropolis. After the costly victory in the war with the old god \
dwarves were too weakened to clear them of remaining demons. Gradually demons have tightened their grip on this place \
and now it's called Demon Halls.\n\n\
Very few adventurers have ever descended this far...
Very few adventurers have ever descended this far...

# Dungeon
dungeon_no_tips = The text is indecipherable...
dungeon_dead_end = What are you doing here?!

dungeon_tip_0 = Don't overestimate your strength, use weapons and armor you can handle.
dungeon_tip_1 = Not all doors in the dungeon are visible at first sight. If you are stuck, search for hidden doors.
dungeon_tip_2 = Remember, that raising your strength is not the only way to access better equipment, you can go \
the other way lowering its strength requirement with Scrolls of Upgrade.
dungeon_tip_3 = You can spend your gold in shops on deeper levels of the dungeon. The first one is on the 6th level.

dungeon_tip_4 = Beware of Goo!

dungeon_tip_5 = Pixel-Mart - all you need for successful adventure!
dungeon_tip_6 = Identify your potions and scrolls as soon as possible. Don't put it off to the moment \
when you actually need them.
dungeon_tip_7 = Being hungry doesn't hurt, but starving does hurt.
dungeon_tip_8 = Surprise attack has a better chance to hit. For example, you can ambush your enemy behind \
a closed door when you know it is approaching.

dungeon_tip_9 = Don't let The Tengu out!

dungeon_tip_10 = Pixel-Mart. Spend money. Live longer.
dungeon_tip_11 = When you're attacked by several monsters at the same time, try to retreat behind a door.
dungeon_tip_12 = If you are burning, you can't put out the fire in the water while levitating.
dungeon_tip_13 = There is no sense in possessing more than one Ankh at the same time, because you will lose them upon resurrecting.

dungeon_tip_14 = DANGER! Heavy machinery can cause injury, loss of limbs or death!

dungeon_tip_15 = Pixel-Mart. A safer life in dungeon.
dungeon_tip_16 = When you upgrade an enchanted weapon, there is a chance to destroy that enchantment.
dungeon_tip_17 = In a Well of Transmutation you can get an item, that cannot be obtained otherwise.
dungeon_tip_18 = The only way to enchant a weapon is by upgrading it with a Scroll of Weapon Upgrade.

dungeon_tip_19 = No weapons allowed in the presence of His Majesty!

dungeon_tip_20 = Pixel-Mart. Special prices for demon hunters!
dungeon_tip_21 = The text is written in demonic language.
dungeon_tip_22 = The text is written in demonic language.
dungeon_tip_23 = The text is written in demonic language.
53 changes: 10 additions & 43 deletions core/src/com/watabou/pixeldungeon/Dungeon.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,47 +66,11 @@

public class Dungeon {

private static final String NO_TIPS = "The text is indecipherable...";
private static final String[] TIPS = {
"Don't overestimate your strength, use weapons and armor you can handle.",
"Not all doors in the dungeon are visible at first sight. If you are stuck, search for hidden doors.",
"Remember, that raising your strength is not the only way to access better equipment, you can go " +
"the other way lowering its strength requirement with Scrolls of Upgrade.",
"You can spend your gold in shops on deeper levels of the dungeon. The first one is on the 6th level.",

"Beware of Goo!",

"Pixel-Mart - all you need for successful adventure!",
"Identify your potions and scrolls as soon as possible. Don't put it off to the moment " +
"when you actually need them.",
"Being hungry doesn't hurt, but starving does hurt.",
"Surprise attack has a better chance to hit. For example, you can ambush your enemy behind " +
"a closed door when you know it is approaching.",

"Don't let The Tengu out!",

"Pixel-Mart. Spend money. Live longer.",
"When you're attacked by several monsters at the same time, try to retreat behind a door.",
"If you are burning, you can't put out the fire in the water while levitating.",
"There is no sense in possessing more than one Ankh at the same time, because you will lose them upon resurrecting.",

"DANGER! Heavy machinery can cause injury, loss of limbs or death!",

"Pixel-Mart. A safer life in dungeon.",
"When you upgrade an enchanted weapon, there is a chance to destroy that enchantment.",
"In a Well of Transmutation you can get an item, that cannot be obtained otherwise.",
"The only way to enchant a weapon is by upgrading it with a Scroll of Weapon Upgrade.",

"No weapons allowed in the presence of His Majesty!",

"Pixel-Mart. Special prices for demon hunters!",
"The text is written in demonic language.",
"The text is written in demonic language.",
"The text is written in demonic language."
};
private static final String NO_TIPS = "dungeon_no_tips";
private static final String TXT_TIP_PREFIX = "dungeon_tip_";
private static final int MAX_TIP = 23;

private static final String TXT_DEAD_END =
"What are you doing here?!";
private static final String TXT_DEAD_END = "dungeon_dead_end";

public static int potionOfStrength;
public static int scrollsOfUpgrade;
Expand Down Expand Up @@ -264,7 +228,10 @@ public static void resetLevel() {
level.reset();
switchLevel( level, level.entrance );
}


/**
* @return the i18n key of the tip
*/
public static String tip() {

if (level instanceof DeadEndLevel) {
Expand All @@ -275,8 +242,8 @@ public static String tip() {

int index = depth - 1;

if (index < TIPS.length) {
return TIPS[index];
if (index <= MAX_TIP) {
return TXT_TIP_PREFIX + index;
} else {
return NO_TIPS;
}
Expand Down
9 changes: 9 additions & 0 deletions core/src/com/watabou/pixeldungeon/actors/Actor.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Arrays;
import java.util.HashSet;

import com.watabou.noosa.Game;
import com.watabou.pixeldungeon.Dungeon;
import com.watabou.pixeldungeon.Statistics;
import com.watabou.pixeldungeon.actors.blobs.Blob;
Expand Down Expand Up @@ -216,4 +217,12 @@ public static Char findChar( int pos ) {
public static HashSet<Actor> all() {
return all;
}

protected String tr(final String key) {
return Game.instance.getI18nBundle().get(key);
}

protected String tr(final String key, final Object... args) {
return Game.instance.getI18nBundle().format(key, args);
}
}
2 changes: 1 addition & 1 deletion core/src/com/watabou/pixeldungeon/actors/hero/Hero.java
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ private void actMove( HeroAction.Move action ) {

} else {
if (Dungeon.level.map[pos] == Terrain.SIGN) {
GameScene.show( new WndMessage( Dungeon.tip() ) );
GameScene.show(new WndMessage(tr(Dungeon.tip())));
}
ready();
}
Expand Down

0 comments on commit 7aa1c59

Please sign in to comment.