Skip to content

Commit

Permalink
Open sources messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhamilton committed Jun 4, 2024
1 parent f040c7d commit fb6641a
Show file tree
Hide file tree
Showing 4 changed files with 445 additions and 0 deletions.
109 changes: 109 additions & 0 deletions tscore/src/main/java/com/timestored/messages/Msg.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/*
* qStudio - Free SQL Analysis Tool
* Copyright C 2013-2024 TimeStored
*
* Licensed under the Apache License, Version 2.0 the "License";
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.timestored.messages;

import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;

import com.google.common.collect.Maps;
import com.google.common.collect.Sets;

/** Provides locale specific i18n test. Allows translated GUIs. */
public class Msg {

private static final String BUNDLE_NAME = "com.timestored.messages.messages";
private static ResourceBundle rb;

static { setLocale(Locale.getDefault()); }

public static enum Key {
BYTE_CODE,

ABOUT, CHART, CONFIRM, CONGRATS_VALID_LICENSE, CONSOLE,
COULD_NOT_LOAD_FILE, DELETE_ALL_SETTINGS, DOCUMENTS,
ENTER_LICENSE_KEY, EXIT, EXPRESSIONS, FILE, FILE_TREE,
GOTO_DEFINITION, HELP, HISTORY, IMPORT, LAUNCH_SQL_DASHBOARDS,
LICENSE_KEY, LOAD_CSV_DATA, NO_FOLDER_SELECTED, OPEN_ALL_RECENT,
OPEN_EXAMPLE_CHARTS, OPEN_QUNIT_EXAMPLE, PLEASE_ENTER_LICENSE_KEY,
PREFERENCES, QUERY, REFRESH, REPORT_A_BUG, RESET_ALL, RESULT,
SELECT_FILE_TO_IMPORT, SERVER, SERVER_TREE, SETTINGS, SORRY_INVALID_LICENSE,
TOOLS, UNSAVED_CHANGES, WELCOME, WINDOWS,

BROWSE_FOLDER, CLOSE, CLOSE_ALL, CLOSE_FOLDER, COPY, CUT, PRINT, DOCS_GENERATED,
DOCUMENT, EROR_OPENING_FILES, ERROR_GENERATING_DOCS, ERROR_OPENING,
ERROR_SAVING, FIND, FIND_NEXT, GENERATE, GENERATE2, GOTO_LINE,
INVALID_DIRECTORY, NEW_FILE, OPEN_CANCELLED, OPEN_DOCS_NOW,
OPEN_FILE, OPEN_FOLDER, PASTE, REDO, SAVE, SAVE_AS,
SAVE_CANCELLED, SAVE_ERROR, SAVE_FILE, SAVE_FILE_ERROR, SELECT_DOC_DIR,
TOGGLE_COMMENTS, UNDO_TYPING, UNSAVED_CHANGES_CONFIRM,

ADD_SERVER, CANCEL_QUERY, CLONE_SERVER, CONNECTION,
COPY_SERVER_LIST_TO_CLIPBOARD, CLOSE_CONNECTION, DELETE_CONNECTION, EDIT,
ERROR, LOAD_SCRIPT_MODULE, NO_CONNECTIONS,
NO_CONNECTIONS_DEFINED, PLEASE_ADD_SERVER_CONNECTION,
PROFILE_SELECTION, QUERY_LINE, QUERY_SELECTION, REMOVE_ALL_SERVERS,
WARNING, WATCH_EXPRESSION,

ROWS, TABLE, STOP, EXPORT, DATABASE, OPEN_IN_EXCEL, USERNAME, PASSWORD,
SERVERS, NEXT_DOCUMENT, PREV_DOCUMENT, EXAMPLE_SCRIPTS, MY_SCRIPTS, CREATE_NEW_FOLDER, CREATE_NEW_FILE;

private static final Map<String, Key> lookup = Maps.newHashMap();

static {
for(Key k : Key.values()) { lookup.put(k.toString(), k); }
}

public static Key get(String k) { return lookup.get(k); }
}

public static String get(Key key) { return rb.getString(key.toString()); }

public static void setLocale(Locale locale){
rb = ResourceBundle.getBundle(BUNDLE_NAME,locale);
}

/**
* @return True if all possible keys are specified in the current resource bundle
*/
static boolean checkAllKeysSpecified() {
for(Key k : Key.values()) {
if(get(k)==null || get(k).trim().length()<1) {
return false;
}
}
return true;
}

/**
* @return Any keys only defined in the resource bundle but not the enumeration
*/
static Set<String> getSuperfluosResourceBundleEntries() {

Set<String> extraKeys = Sets.newHashSet();
Enumeration<String> keys = rb.getKeys();
while(keys.hasMoreElements()) {
String k = keys.nextElement();
if(Key.get(k)==null) {
extraKeys.add(k);
}
}
return extraKeys;
}
}
120 changes: 120 additions & 0 deletions tscore/src/main/java/com/timestored/messages/messages.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
BYTE_CODE=Bytecode

ABOUT=About
CHART=Chart
CONFIRM=Confirm
CONGRATS_VALID_LICENSE=Congratulations you have successfully registered your license
CONSOLE=Console
COULD_NOT_LOAD_FILE=Could not load file
DELETE_ALL_SETTINGS=Delete all settings?
DOCUMENTS=Documents
EDIT=Edit
ENTER_LICENSE_KEY=Enter License Key
EXIT=Exit
EXPRESSIONS=Expressions
FILE=File
FILE_TREE=File Tree
GOTO_DEFINITION=Goto Definition:
HELP=Help
HISTORY=History
IMPORT=Import
PRINT=Print
LAUNCH_SQL_DASHBOARDS=Launch sqlDashboards
LICENSE_KEY=License Key
LOAD_CSV_DATA=Load CSV Data
NO_FOLDER_SELECTED=No Folder Selected
OPEN_ALL_RECENT=Open All Recent
OPEN_EXAMPLE_CHARTS=Open Example Charts .q
OPEN_QUNIT_EXAMPLE=Open qunit example .q
PLEASE_ENTER_LICENSE_KEY=Please enter your license key:
PREFERENCES=Preferences...
QUERY=Query
REFRESH=Refresh
REPORT_A_BUG=Report a Bug
RESET_ALL=Reset All...
RESULT=Result
SELECT_FILE_TO_IMPORT=Select File to import data from
SERVER=Server
SERVERS=Servers
SERVER_TREE=Server Tree
SETTINGS=Settings
SORRY_INVALID_LICENSE=Sorry that license doesn't appear to be a valid signed license. \r\nPlease contact [email protected] for help
TOOLS=Tools
UNSAVED_CHANGES=You have unsaved changes.\r\nAre you sure you want to quit?
WELCOME=Welcome
WINDOWS=Windows
QUERY_LINE=Query Line
QUERY_SELECTION=Query Selected Text
REMOVE_ALL_SERVERS=Remove all Servers...
WARNING=Warning
WATCH_EXPRESSION=Watch Expression
BROWSE_FOLDER=Browse For Folder
CLOSE=Close
CLOSE_ALL=Close All
CLOSE_FOLDER=Close Folder
COPY=Copy
CUT=Cut
DOCS_GENERATED=All Docs generated Successfully
DOCUMENT=Document
EROR_OPENING_FILES=Error opening files:
ERROR_GENERATING_DOCS=Error Generating Documentation
ERROR_OPENING=Error Opening
ERROR_SAVING=Error saving file
FIND=Find
FIND_NEXT=Find Next
GENERATE=Generate All Documentation
GENERATE2=Generate
GOTO_LINE=Goto Line
INVALID_DIRECTORY=Selected path is not a valid directory.
NEW_FILE=New File
OPEN_CANCELLED=Open command cancelled by user.
OPEN_DOCS_NOW=Open Docs Now
OPEN_FILE=Open File
OPEN_FOLDER=Open Folder
PASTE=Paste
REDO=Redo
SAVE=Save
SAVE_AS=Save As
SAVE_CANCELLED=Save command cancelled by user.
SAVE_ERROR=Error Saving
SAVE_FILE=Save File
SAVE_FILE_ERROR=Error saving file
TOGGLE_COMMENTS=Toggle Comments
UNDO_TYPING=Undo Typing
UNSAVED_CHANGES_CONFIRM=\ has unsaved changes. \r\nDo you want to save it now?
SELECT_DOC_DIR=Browse For Folder
ADD_SERVER=Add Server...
CANCEL_QUERY=Cancel Query
CLONE_SERVER=Clone Server...
CONNECTION=\ Connection
COPY=copy
COPY_SERVER_LIST_TO_CLIPBOARD=Copy Server List to Clipboard
DELETE_CONNECTION=Delete Connection
CLOSE_CONNECTION=Close Connection
EDIT=Edit
ERROR=Error
LOAD_SCRIPT_MODULE=Load Script Module
NO_CONNECTIONS=No Connections
NO_CONNECTIONS_DEFINED=There are no connections defined.
PLEASE_ADD_SERVER_CONNECTION=\r\nPlease add a server connection
PROFILE_SELECTION=Profile Selected Text
OPEN_IN_EXCEL=Open in Excel
EXPORT=Export
DATABASE=Database
STOP=Stop
TABLE=Table
ROWS=Rows
USERNAME=Username
PASSWORD=Password
NEXT_DOCUMENT=Move to next document
PREV_DOCUMENT=Move to previous document
EXAMPLE_SCRIPTS=Example Scripts
MY_SCRIPTS=My Scripts
CREATE_NEW_FOLDER=New Folder
CREATE_NEW_FILE=New File
108 changes: 108 additions & 0 deletions tscore/src/main/java/com/timestored/messages/messages_zh.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
\ufeffABOUT=\u5173\u4e8e
CHART=\u56fe\u8868
CONFIRM=\u786e\u8ba4
CONGRATS_VALID_LICENSE=\u606d\u559c\u4f60\u5df2\u7ecf\u6210\u529f\u6ce8\u518c\u8bb8\u53ef\u8bc1
CONSOLE=Console
COULD_NOT_LOAD_FILE=\u65e0\u6cd5\u52a0\u8f7d\u6587\u4ef6
DELETE_ALL_SETTINGS=\u5220\u9664\u6240\u6709\u7684\u8bbe\u7f6e\uff1f
DOCUMENTS=\u6587\u4ef6
ENTER_LICENSE_KEY=\u8f93\u5165\u8bb8\u53ef\u8bc1\u5bc6\u94a5
EXIT=\u9000\u51fa
EXPRESSIONS=\u7a0b\u5f0f
FILE=\u6587\u4ef6
FILE_TREE=\u5377\u5b97
GOTO_DEFINITION=Goto Definition:
HELP=\u5e2e\u52a9
HISTORY=\u6b77\u53f2
IMPORT=Import
PRINT=\u6253\u5370
LAUNCH_SQL_DASHBOARDS=Launch sqlDashboards
LICENSE_KEY=\u8bb8\u53ef\u8bc1\u5bc6\u94a5
LOAD_CSV_DATA=Load CSV Data
NO_FOLDER_SELECTED=No Folder Selected
OPEN_ALL_RECENT=\u6253\u5f00\u6240\u6709\u6700\u8fd1\u4f7f\u7528\u7684\u6587\u6863
OPEN_EXAMPLE_CHARTS=Open Example Charts .q
OPEN_QUNIT_EXAMPLE=Open qunit example .q
PLEASE_ENTER_LICENSE_KEY=Please enter your license key:
PREFERENCES=\u9996...
QUERY=\u67e5\u8be2
REFRESH=\u5237\u65b0
REPORT_A_BUG=Report a Bug
RESET_ALL=\u5168\u90e8\u91cd\u7f6e...
RESULT=\u7ed3\u679c
SELECT_FILE_TO_IMPORT=Select File to import data from
SERVER=\u670d\u52a1\u5668
SERVERS=\u670d\u52a1\u5668
SERVER_TREE=\u670d\u52d9\u5668\u6811
SETTINGS=\u8bbe\u7f6e
SORRY_INVALID_LICENSE=Sorry that license doesn't appear to be a valid signed license. \r\nPlease contact [email protected] for help
TOOLS=\u5de5\u5177
UNSAVED_CHANGES=You have unsaved changes.\r\nAre you sure you want to quit?
WELCOME=\u6b22\u8fce
WINDOWS=\u7a97
QUERY_LINE=\u6267\u884c\u5f53\u524d\u884c
QUERY_SELECTION=Query Selected Text
REMOVE_ALL_SERVERS=Remove all Servers...
WARNING=\u8b66\u544a
WATCH_EXPRESSION=Watch Expression
BROWSE_FOLDER=\u6d4f\u89c8\u6587\u4ef6\u5939
CLOSE=\u5173\u95ed
CLOSE_ALL=\u5173\u95ed\u6240\u6709\u6587\u6863
CLOSE_FOLDER=\u5173\u95ed\u6587\u4ef6\u5939
COPY=\u590d\u5236
CUT=\u526a\u5207
DOCS_GENERATED=All Docs generated Successfully
DOCUMENT=\u6587\u6863
EROR_OPENING_FILES=\u9519\u8bef\u6253\u5f00\u6587\u4ef6:
ERROR_GENERATING_DOCS=\u9519\u8bef\u751f\u6210\u6587\u6863
ERROR_OPENING=\u9519\u8bef\u6253\u5f00
ERROR_SAVING=\u4fdd\u5b58\u6587\u4ef6\u65f6\u51fa\u9519
FIND=\u67e5\u627e
FIND_NEXT=\u67e5\u627e\u4e0b\u4e00\u4e2a
GENERATE=Generate All Documentation
GENERATE2=Generate
GOTO_LINE=\u8f6c\u5230\u884c
INVALID_DIRECTORY=Selected path is not a valid directory.
NEW_FILE=\u65b0\u5efa
OPEN_CANCELLED=Open command cancelled by user.
OPEN_DOCS_NOW=Open Docs Now
OPEN_FILE=\u6253\u5f00
OPEN_FOLDER=\u6253\u5f00\u6587\u4ef6\u5939
PASTE=\u7c98\u8d34
REDO=\u91cd\u590d
SAVE=\u4fdd\u5b58
SAVE_AS=\u53e6\u5b58\u4e3a
SAVE_CANCELLED=Save command cancelled by user.
SAVE_ERROR=\u4fdd\u5b58\u65f6\u51fa\u9519
SAVE_FILE=\u4fdd\u5b58\u6587\u4ef6
SAVE_FILE_ERROR=Error saving file
TOGGLE_COMMENTS=Toggle Comments
UNDO_TYPING=\u64a4\u6d88
UNSAVED_CHANGES_CONFIRM=\ has unsaved changes. \r\nDo you want to save it now?
SELECT_DOC_DIR=Browse For Folder
ADD_SERVER=\u6dfb\u52a0\u670d\u52a1\u5668...
CANCEL_QUERY=\u53d6\u6d88
CLONE_SERVER=\u514b\u9686...
CONNECTION=\ \u670d\u52a1\u5668\u8fde\u63a5
COPY_SERVER_LIST_TO_CLIPBOARD=Copy Server List to Clipboard
DELETE_CONNECTION=Delete Connection
EDIT=\u7f16\u8f91
ERROR=\u9519\u8bef
LOAD_SCRIPT_MODULE=Load Script Module
NO_CONNECTIONS=No Connections
NO_CONNECTIONS_DEFINED=There are no connections defined.
PLEASE_ADD_SERVER_CONNECTION=\r\n\u8bf7\u6dfb\u52a0\u670d\u52a1\u5668\u8fde\u63a5
PROFILE_SELECTION=Profile Selected Text
OPEN_IN_EXCEL=\u6253\u5f00Excel
EXPORT=\u5bfc\u51fa...
DATABASE=\u6570\u636e\u5e93
STOP=\u505c\u6b62
TABLE=\u8868
ROWS=\u884c
USERNAME=\u7528\u6237\u540d
PASSWORD=\u5bc6\u7801
Loading

0 comments on commit fb6641a

Please sign in to comment.