@@ -47,6 +47,11 @@ public TextManager(QuickShop plugin) {
4747
4848 }
4949
50+ /**
51+ * Generate the override files storage path
52+ * @param crowdinPath The crowdin file path
53+ * @return Override files storage path
54+ */
5055 @ NotNull
5156 private File getOverrideFilesFolder (@ NotNull String crowdinPath ) {
5257 File file = new File (crowdinPath );
@@ -55,11 +60,21 @@ private File getOverrideFilesFolder(@NotNull String crowdinPath) {
5560 return folder ;
5661 }
5762
63+ /**
64+ * Reset everything
65+ */
5866 private void reset () {
5967 locale2ContentMapping .clear ();
6068 postProcessors .clear ();
69+ bundledFile2ContentMapping .clear ();
70+ disabledLanguages .clear ();
6171 }
6272
73+ /**
74+ * Loading bundled files from Jar file
75+ * @param file The Crowdin file path
76+ * @return The bundled file configuration object
77+ */
6378 private JsonConfiguration loadBundled (String file ) {
6479 JsonConfiguration bundledLang = new JsonConfiguration ();
6580 try {
@@ -72,6 +87,9 @@ private JsonConfiguration loadBundled(String file) {
7287 return bundledLang ;
7388 }
7489
90+ /**
91+ * Loading Crowdin OTA module and i18n system
92+ */
7593 public void load () {
7694 plugin .getLogger ().info ("Checking for translation updates..." );
7795 this .reset ();
@@ -110,6 +128,7 @@ public void load() {
110128 localOverrideFile .createNewFile ();
111129 }
112130 override .loadFromString (Util .readToString (localOverrideFile ));
131+ // Prevent user override important keys
113132 for (String key : override .getKeys (true )) {
114133 if (key .equals ("language-version" ) || key .equals ("config-version" ) || key .equals ("version" ))
115134 continue ;
@@ -118,10 +137,13 @@ public void load() {
118137 locale2ContentMapping .get (languageFileCrowdin ).computeIfAbsent (minecraftCode , e -> configuration );
119138 Util .debugLog ("Locale " + crowdinFile + " has been successfully loaded" );
120139 } catch (CrowdinOTA .OTAException e ) {
140+ // Key founds in available locales but not in custom mapping on crowdin platform
121141 plugin .getLogger ().warning ("Couldn't update the translation for locale " + crowdinCode + " because it not configured, please report to QuickShop" );
122142 } catch (IOException e ) {
143+ // Network error
123144 plugin .getLogger ().log (Level .WARNING , "Couldn't update the translation for locale " + crowdinCode + " please check your network connection." , e );
124145 } catch (Exception e ) {
146+ // Translation syntax error or other exceptions
125147 plugin .getLogger ().log (Level .WARNING , "Couldn't update the translation for locale " + crowdinCode + "." , e );
126148 }
127149 }));
0 commit comments