Browse Source

Auto-generate placeholder localizations

Add a trigger to automatically initialize placeholder localization
entries.
nosoop 6 years ago
parent
commit
2af39f5039

+ 7 - 0
configs/sql-init-scripts/sqlite/custom_achievements.sql

@@ -27,3 +27,10 @@ CREATE TABLE achievement_languages (
 	achievement_local_description TEXT,
 	CONSTRAINT achievement_in_language UNIQUE(achievement_name, language_shortcode)
 );
+
+/* automatically create language placeholder entries */
+CREATE TRIGGER create_achievement_localizations AFTER INSERT ON achievements BEGIN
+	INSERT INTO achievement_languages (achievement_name, language_shortcode,
+			achievement_local_name, achievement_local_description) VALUES
+			(NEW.name, 'en', NEW.name, NEW.name || '_description');  
+END;

+ 4 - 1
scripting/include/custom_achievements.inc

@@ -7,6 +7,9 @@
 /**
  * Controls type of achievement.  Intended to be used when displaying the achievements in some
  * fashion (e.g., on a webpage).
+ * 
+ * This has been deprecated; any applications wishing to integrate will have to understand the
+ * meaning of the metadata themselves.
  */
 enum AchievementStyle {
 	AchievementStyle_Undefined = 0, // Style is undefined (may need to be custom-made).
@@ -88,7 +91,7 @@ methodmap CustomAchievement {
 	 * the specified account.
 	 * 
 	 * There is no `CustomAchievement.Reset(int client)` by design as achievements are not meant
-	 * to be reset so often.
+	 * to be reset so often; this is mainly intended as a built-in testing function.
 	 */
 	public native void ResetByAccountID(int steamid3);
 }