mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Merge pull request #2844 from federicobond/fix-osx-localization
Fix localization in OS X
This commit is contained in:
@@ -87,6 +87,7 @@ public class Language {
|
||||
|
||||
static private String[] listSupported() {
|
||||
// List of languages in alphabetical order. (Add yours here.)
|
||||
// Also remember to add it to the corresponding build/build.xml rule.
|
||||
final String[] SUPPORTED = {
|
||||
"de", // German, Deutsch
|
||||
"en", // English
|
||||
@@ -147,6 +148,7 @@ public class Language {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Base.getPlatform().saveLanguage(language);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ public class Platform {
|
||||
}
|
||||
}
|
||||
|
||||
public void saveLanguage(String languageCode) {}
|
||||
|
||||
public void init(Base base) {
|
||||
this.base = base;
|
||||
@@ -216,4 +217,4 @@ public class Platform {
|
||||
null);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ package processing.app.platform;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.apple.eio.FileManager;
|
||||
|
||||
@@ -47,6 +48,18 @@ public class MacPlatform extends Platform {
|
||||
}
|
||||
*/
|
||||
|
||||
public void saveLanguage(String language) {
|
||||
String[] cmdarray = new String[]{
|
||||
"defaults", "write",
|
||||
System.getProperty("user.home") + "/Library/Preferences/org.processing.app",
|
||||
"AppleLanguages", "-array", language
|
||||
};
|
||||
try {
|
||||
Runtime.getRuntime().exec(cmdarray);
|
||||
} catch (IOException e) {
|
||||
Base.log("Error saving platform language: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void init(Base base) {
|
||||
super.init(base);
|
||||
@@ -205,4 +218,4 @@ public class MacPlatform extends Platform {
|
||||
protected String getDocumentsFolder() throws FileNotFoundException {
|
||||
return FileManager.findFolder(kUserDomain, kDocumentsFolderType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user