Skip to content
Permalink
Browse files
Fix bugs in localization ui
  • Loading branch information
LadyCailin committed Jul 6, 2020
1 parent 1a5ff30 commit f4b78d7f9a3ef35d51ce240aae7b8ab4f5099b76
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
@@ -21,7 +21,6 @@
import com.laytonsmith.core.constructs.Construct;
import com.laytonsmith.core.constructs.Target;
import com.laytonsmith.core.environments.Environment;
import com.laytonsmith.core.environments.GlobalEnv;
import com.laytonsmith.core.environments.StaticRuntimeEnv;
import com.laytonsmith.core.exceptions.CRE.CREFormatException;
import com.laytonsmith.core.exceptions.CRE.CREIOException;
@@ -116,8 +115,7 @@ CArray toOptionsArray() {
}
}

public static String execute(GlobalEnv gEnv, OAuthOptions options) {
Environment env = Environment.createEnvironment(gEnv);
public static String execute(Environment env, OAuthOptions options) {
return new x_get_oauth_token().exec(Target.UNKNOWN, env, options.toOptionsArray()).val();
}

@@ -497,12 +495,11 @@ public static class clear_oauth_tokens extends AbstractFunction {
* @param gEnv
* @param clientId If set, clears just the one client id, if null, clears all tokens.
*/
public static void execute(GlobalEnv gEnv, String clientId) {
public static void execute(Environment env, String clientId) {
Mixed[] args = new Mixed[0];
if(clientId != null) {
args = new Mixed[]{new CString(clientId, Target.UNKNOWN)};
}
Environment env = Environment.createEnvironment(gEnv);
new clear_oauth_tokens().exec(Target.UNKNOWN, env, args);
}

@@ -17,6 +17,7 @@
import com.laytonsmith.core.Profiles;
import com.laytonsmith.core.ProfilesImpl;
import com.laytonsmith.core.Static;
import com.laytonsmith.core.environments.Environment;
import com.laytonsmith.core.environments.GlobalEnv;
import com.laytonsmith.core.environments.RuntimeMode;
import com.laytonsmith.core.environments.StaticRuntimeEnv;
@@ -1811,11 +1812,12 @@ public void authorizeGithub(boolean clearFirst, GithubAuthSuccess success) {
= new OAuth.x_get_oauth_token.OAuthOptions(authorizationUrl, clientId, clientSecret, scope, tokenUrl);
new Thread(() -> {
try {
Environment env = Environment.createEnvironment(gEnv, staticRuntimeEnv);
if(clearFirst) {
OAuth.clear_oauth_tokens.execute(gEnv, clientId);
OAuth.clear_oauth_tokens.execute(env, clientId);
}
options.forcePort = 5346;
String githubOAuthToken = OAuth.x_get_oauth_token.execute(gEnv, options);
String githubOAuthToken = OAuth.x_get_oauth_token.execute(env, options);
success.token(githubOAuthToken);
} catch (Exception ex) {
showError(ex.getMessage());
@@ -369,7 +369,7 @@
key = key.replace(/ /g, "\\s+");
// We only want to replace strings where the whole thing is within a border. For instance, if one segment
// is A, and another is ABC, we don't want to replace the A in ABC, because then the match for ABC won't
// work. Instead, we need to ensure that we're only replacing entire segments, which means essentially
// work. Instead, we need to ensure that we're only replacing entire segments, which means essentially
// reversing the segmentation logic that was originally used.
let spacer = "(\\s*(?:==+|\n\n|\n\*|\n#)\\s*)";
key = spacer + key + spacer;
@@ -397,7 +397,7 @@
}
if (productionTranslations !== "" && lang !== null && lang !== "en") {
// We need to download and parse the locale data first
let pageTranslations = productionTranslations + "/" + lang + "/"
let pageTranslations = productionTranslations + "/" + lang
+ window.location.pathname.replace(/\.html$/, ".tmem.xml");
$.get(pageTranslations, function (data) {
$data = $($.parseXML(data));

0 comments on commit f4b78d7

Please sign in to comment.