Skip to content
This repository has been archived by the owner on Mar 15, 2023. It is now read-only.

Commit

Permalink
Introduction of projects and preparation for first major release.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob van Mourik committed Jan 28, 2017
1 parent 60171ad commit 76e10a9
Show file tree
Hide file tree
Showing 29 changed files with 1,231 additions and 535 deletions.
2 changes: 1 addition & 1 deletion .inno.iss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define AppName "i18n-editor"
#define AppVersion "1.0.0"
#define AppVersion "1.0.0-beta.1"
#define AppPublisher "JvMs Software"
#define AppURL "https://github.com/jcbvm/i18n-editor"
#define AppExeName "i18n-editor.exe"
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.jvms</groupId>
<artifactId>i18n-editor</artifactId>
<version>1.0.0</version>
<version>1.0.0-beta.1</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/jvms/i18neditor/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

import com.jvms.i18neditor.editor.Editor;

/**
*
* @author Jacob
*/
public class Main {

public static void main(String[] args) throws IOException {
Expand Down
27 changes: 11 additions & 16 deletions src/main/java/com/jvms/i18neditor/Resource.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,15 @@
public class Resource {
private final Path path;
private final Locale locale;
private final SortedMap<String,String> translations;
private final List<ResourceListener> listeners = Lists.newLinkedList();
private final ResourceType type;
private final List<ResourceListener> listeners = Lists.newLinkedList();
private SortedMap<String,String> translations = Maps.newTreeMap();

/**
* An enum for defining the type of a resource.
*/
public enum ResourceType {
JSON, ES6
}

/**
* See {@link #Resource(ResourceType, Path, Locale, SortedMap)}.
* See {@link #Resource(ResourceType, Path, Locale)}.
*/
public Resource(ResourceType type, Path path, Locale locale) {
this(type, path, locale, Maps.newTreeMap());
public Resource(ResourceType type, Path path) {
this(type, path, null);
}

/**
Expand All @@ -54,11 +47,9 @@ public Resource(ResourceType type, Path path, Locale locale) {
* @param type the type of the resource.
* @param path the path to the file on disk.
* @param locale the locale of the translations.
* @param translations the actual translation data.
*/
public Resource(ResourceType type, Path path, Locale locale, SortedMap<String,String> translations) {
public Resource(ResourceType type, Path path, Locale locale) {
this.path = path;
this.translations = translations;
this.locale = locale;
this.type = type;
}
Expand All @@ -84,7 +75,7 @@ public Path getPath() {
/**
* Gets the locale of the translations of the resource.
*
* @return the locale of the resource.
* @return the locale of the resource, may be {@code null}.
*/
public Locale getLocale() {
return locale;
Expand All @@ -103,6 +94,10 @@ public SortedMap<String,String> getTranslations() {
return ImmutableSortedMap.copyOf(translations);
}

public void setTranslations(SortedMap<String,String> translations) {
this.translations = translations;
}

/**
* Gets a translation from the resource's translations.
*
Expand Down
38 changes: 38 additions & 0 deletions src/main/java/com/jvms/i18neditor/ResourceType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.jvms.i18neditor;

/**
* An enum describing the type of a {@link Resource}.
*
* <p>A resource type additionally holds information about the filename representation.</p>
*/
public enum ResourceType {
JSON(".json", false),
ES6(".js", false),
Properties(".properties", true);

private final String extension;
private final boolean embedLocale;

/**
* Gets the file extension of the resource type.
*
* @return the file extension.
*/
public String getExtension() {
return extension;
}

/**
* Whether the locale should be embedded in the filename for this resource type.
*
* @return whether the locale should be embedded in the filename.
*/
public boolean isEmbedLocale() {
return embedLocale;
}

private ResourceType(String extension, boolean embedLocale) {
this.extension = extension;
this.embedLocale = embedLocale;
}
}
Loading

0 comments on commit 76e10a9

Please sign in to comment.