feat: Add naming convention setting for presets
Implemented a new setting, `getCaseFormat`, in the `ProjectSettings` interface, returning the naming convention used. Also extended corresponding implementations (`DefaultPreset`, `VueI18nPreset`, `ReactI18NextPreset`, `SettingsTestPreset`) to return `NamingConvention.CAMEL_CASE`. A new enum `NamingConvention` was created for this, with options `SNAKE_CASE` and `CAMEL_CASE`.
This commit is contained in:
parent
08d8326523
commit
0c1710029f
@ -0,0 +1,18 @@
|
||||
package de.marhali.easyi18n.settings;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
|
||||
public enum NamingConvention {
|
||||
SNAKE_CASE("Snake"),
|
||||
CAMEL_CASE("Camel"),;
|
||||
private final String name;
|
||||
|
||||
private NamingConvention(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.name().toLowerCase();
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package de.marhali.easyi18n.settings;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
import de.marhali.easyi18n.io.parser.ParserStrategyType;
|
||||
import de.marhali.easyi18n.io.folder.FolderStrategyType;
|
||||
|
||||
@ -34,4 +35,5 @@ public interface ProjectSettings {
|
||||
// Experimental Configuration
|
||||
boolean isAlwaysFold();
|
||||
String getFlavorTemplate();
|
||||
@NotNull NamingConvention getCaseFormat();
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package de.marhali.easyi18n.settings.presets;
|
||||
|
||||
import de.marhali.easyi18n.io.parser.ParserStrategyType;
|
||||
import de.marhali.easyi18n.io.folder.FolderStrategyType;
|
||||
import de.marhali.easyi18n.settings.NamingConvention;
|
||||
import de.marhali.easyi18n.settings.ProjectSettings;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -91,4 +92,9 @@ public class DefaultPreset implements ProjectSettings {
|
||||
public String getFlavorTemplate() {
|
||||
return "$i18n.t";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull NamingConvention getCaseFormat() {
|
||||
return NamingConvention.CAMEL_CASE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package de.marhali.easyi18n.settings.presets;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
import de.marhali.easyi18n.io.parser.ParserStrategyType;
|
||||
import de.marhali.easyi18n.io.folder.FolderStrategyType;
|
||||
import de.marhali.easyi18n.settings.NamingConvention;
|
||||
import de.marhali.easyi18n.settings.ProjectSettings;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -91,4 +93,8 @@ public class ReactI18NextPreset implements ProjectSettings {
|
||||
public String getFlavorTemplate() {
|
||||
return "$i18n.t";
|
||||
}
|
||||
@Override
|
||||
public @NotNull NamingConvention getCaseFormat() {
|
||||
return NamingConvention.CAMEL_CASE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package de.marhali.easyi18n.settings.presets;
|
||||
|
||||
import de.marhali.easyi18n.io.parser.ParserStrategyType;
|
||||
import de.marhali.easyi18n.io.folder.FolderStrategyType;
|
||||
import de.marhali.easyi18n.settings.NamingConvention;
|
||||
import de.marhali.easyi18n.settings.ProjectSettings;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@ -90,4 +91,9 @@ public class VueI18nPreset implements ProjectSettings {
|
||||
public String getFlavorTemplate() {
|
||||
return "$i18n.t";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull NamingConvention getCaseFormat() {
|
||||
return NamingConvention.CAMEL_CASE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package de.marhali.easyi18n.settings;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
import de.marhali.easyi18n.io.folder.FolderStrategyType;
|
||||
import de.marhali.easyi18n.io.parser.ParserStrategyType;
|
||||
|
||||
@ -8,6 +9,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Settings preset to test the functionality of the settings service.
|
||||
*
|
||||
* @author marhali
|
||||
*/
|
||||
public class SettingsTestPreset implements ProjectSettings {
|
||||
@ -88,6 +90,11 @@ public class SettingsTestPreset implements ProjectSettings {
|
||||
|
||||
@Override
|
||||
public String getFlavorTemplate() {
|
||||
return "";
|
||||
return "t";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull NamingConvention getCaseFormat() {
|
||||
return NamingConvention.CAMEL_CASE;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user