-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
11 changed files
with
169 additions
and
30 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package net.cactusthorn; | ||
|
||
import java.net.URISyntaxException; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
import java.util.Locale; | ||
|
||
import net.cactusthorn.localization.BasicLocalizationTest; | ||
import net.cactusthorn.localization.L10n; | ||
import net.cactusthorn.localization.LoggingLocalization; | ||
|
||
public class L10nExample { | ||
|
||
static Locale en_US = Locale.forLanguageTag("en-US"); | ||
|
||
static { | ||
try { | ||
Path path = Paths.get(BasicLocalizationTest.class.getClassLoader().getResource("L10n").toURI()); | ||
L10n.theOnlyAttemptToInitInstance("test-app", path, LoggingLocalization.class); | ||
} catch (URISyntaxException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public static void main(String... args) { | ||
System.out.println(L10n.instance().get(en_US, "super.key")); | ||
} | ||
|
||
} |
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,31 @@ | ||
package net.cactusthorn; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
import java.util.Locale; | ||
|
||
import net.cactusthorn.localization.Localization; | ||
import net.cactusthorn.localization.LocalizationLoader; | ||
|
||
public class SimpleExample { | ||
|
||
static Locale en_US = Locale.forLanguageTag("en-US"); | ||
|
||
public static void main(String... args) { | ||
|
||
try { | ||
|
||
String systemId = args[0]; | ||
|
||
Path l10nDirectory = Paths.get(args[1]); | ||
|
||
Localization localization = new LocalizationLoader(systemId ).fromDirectory(l10nDirectory ).load(); | ||
|
||
System.out.println(localization.get(en_US, "super.key")); | ||
|
||
} catch (IOException e ) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
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