Update arguments generated

This commit is contained in:
Balazs Perlaki-Horvath 2025-01-22 15:42:45 +01:00 committed by Kelson
parent 921cb9e4eb
commit 385d473e16

View File

@ -1,7 +1,6 @@
import os
import argparse
import re
import subprocess
import glob
from pathlib import Path
@ -44,6 +43,8 @@ class Generate:
def __code_for(self, variables):
return """
// Do not edit this file directly, it has been auto-generated
enum {} {{
{}
}}
@ -53,7 +54,7 @@ enum {} {{
return """static let {} = "{}".localized""".format(self.__get_var_name(key), key)
def __static_func_for(self, key):
return """static func {}(withArgs: CVarArg...) -> String {{ "{}".localizedWithFormat(withArgs) }}""".format(self.__get_var_name(key), key)
return """static func {}(withArgs args: CVarArg...) -> String {{ "{}".localizedWithFormat(withArgs: args) }}""".format(self.__get_var_name(key), key)
def __get_var_name(self, key):
return re.sub('[^a-z0-9]', '_', key.lower())
@ -92,8 +93,7 @@ class Validate:
if var in matches:
matches[var].append(swift_file_name)
else:
matches[var] = []
print(matches)
matches[var] = []
assert len(matches.keys()) == 0, "localization strings are still used in: {}".format(matches)
match command: