Localization
Table of contents
Localization
DBeaver uses the standard properties-based i18n model.
All translatable resources reside in the *.properties file. Each plugin (bundle) has its own set of resources.
Almost all plugins have at least a bundles.properties
resource. More extensive plugins have additional resources in the src folder.
See the complete list of property files below.
bundle.properties contains an original string in the English language. All translated resources are placed in bundle_XX.properties files where XX is a two-letter language code.
Adding new languages
If you want to add a new language that was not previously supported, you need to register it to be shown in the UI:
- Open the file
plugins/org.jkiss.dbeaver.registry/plugin.xml
- Navigate to the line containing
<extension point="org.jkiss.dbeaver.language">
- Copy one of the existing
<language>
elements and change theid
andname
attributes to the desired values.id
must match the language code. - Now, you need to localize the language name. Open the file
OSGI-INF/l10n/bundle.properties
and add it here.
Example of adding Hebrew language:
--- a/plugins/org.jkiss.dbeaver.registry/plugin.xml +++ b/plugins/org.jkiss.dbeaver.registry/plugin.xml @@ -36,6 +36,7 @@ <language code="es" label="%language.es.label" /> <language code="tw" label="%language.tw.label" /> <language code="uk" label="%language.uk.label" /> + <language code="he" label="%language.he.label" /> </extension>
Environment setup
Clone DBeaver repository
- Install GitHub Desktop
- In the top menu, select File -> Clone Repository
- In the appeared popup window, select the URL tab and paste DBeaver URL:
https://github.com/dbeaver/dbeaver.git
- Press Clone
Localizing tools
Eclipse IDE
- Install Eclipse (any version, any package)
- Install ResourceBundle Editor plugin.
- Main menu Help ->
Install New Software
->https://raw.githubusercontent.com/essiembre/eclipse-rbe/master/eclipse-rbe-update-site/site.xml
- Main menu Help ->
- Main menu -> File -> Import... -> General -> Existing Projects into Workspace -> Browse
- Choose your DBeaver clone directory and import all projects
- Open some properties file (e.g. bundle.properties - see below ) in ResourceBundle editor:
Edit properties:
Intellij IDEA Community
Non-ASCII symbols are encoded to uppercase and lowercase hex sequences (for example, \u00E3 and \u00e3). By default, only uppercase sequences are enabled in IntelliJ IDEA. Before starting your work, Please set the idea.native2ascii.lowercase
property in the idea.properties
file to true
to avoid unintended changes.
Contribution
Please note that according to the Contribution guide, it's required to add the issue number to the commit message. If there is no such issue, then you should create one.
Push your changes
- Open GitHub Desktop
- At the top, select Current branch and press the New Branch button
- Create a new branch with a name related to l10n
- Commit to the new branch
- Publish brunch/push (right button at the top)
- Fetch origin (right button at the top)
- In the main menu, select Branch -> Create Pull Request
- On the opened GitHub page, add some meaningful text for your pull request name and press the Create pull request button
- Return to GitHub Desktop and switch to devel branch
or
Create a Pull Request with your changes (in branch devel
)
https://help.github.com/articles/creating-a-pull-request-from-a-fork/
Properties
Module | Purpose | File |
---|---|---|
Core | Commands, properties | plugins/org.jkiss.dbeaver.core/OSGI-INF/l10n/bundle.properties |
Core | Messages, UI strings | plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreResources.properties |
API | Properties | plugins/org.jkiss.dbeaver.model/OSGI-INF/l10n/bundle.properties |
API | Messages | plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/messages/ModelResources.properties |
UI | Properties | plugins/org.jkiss.dbeaver.ui/OSGI-INF/l10n/bundle.properties |
UI | Messages | plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/bundle/UIMessages.properties |
Application (Standalone) | Commands, properties | plugins/org.jkiss.dbeaver.ui.app.standalone/OSGI-INF/l10n/bundle.properties |
Application (Eclipse) | Commands, properties | plugins/org.jkiss.dbeaver.ui.app.eclipse/OSGI-INF/l10n/bundle.properties |
Data Transfer | Commands, properties | plugins/org.jkiss.dbeaver.ext.data.transfer/OSGI-INF/l10n/bundle.properties |
Data Transfer | Messages | plugins/org.jkiss.dbeaver.ext.data.transfer/src/org/jkiss/dbeaver/tools/transfer/internal/DTMessages.properties |
ERD | Commands, properties | plugins/org.jkiss.dbeaver.ext.erd/OSGI-INF/l10n/bundle.properties |
ERD | Messages | plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/ERDResources.properties |
SSH | Commands, properties | plugins/org.jkiss.dbeaver.net.ssh/OSGI-INF/l10n/bundle.properties |
SSH | Messages | plugins/org.jkiss.dbeaver.net.ssh.ui/src/org/jkiss/dbeaver/ui/net/ssh/SSHUIMessages.properties |
Generic driver | Properties | plugins/org.jkiss.dbeaver.ext.generic/OSGI-INF/l10n/bundle.properties |
Generic driver | Messages | plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/GenericResources.properties |
MySQL | Properties | plugins/org.jkiss.dbeaver.ext.mysql/OSGI-INF/l10n/bundle.properties |
MySQL | Messages | plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/MySQLResources.properties |
.. | .. | The same for Oracle (ext.oracle), DB2 (ext.db2), Exasol (ext.exasol), PostgreSQL (ext.postgresql), and SQL Server (ext.mssql) |
Important notice
Using placeholders in localization files
When localizing messages that include segments from the running application, you should use text placeholders instead of manually concatenating strings in the code.
A placeholder is a special marker represented as
{N}
, whereN
is a number starting from0
. These placeholders are later replaced with provided values.`
java // Will result in "This is my text: hello from DBeaver" NLS.bind("This is my text: {0} from {1}", "hello", "DBeaver");`
Dealing with single quotes
If you're editing the text manually and your message contains single quotes, you must double them:
- Wrong:
Can't delete '{0}'
- Right:
Can''t delete ''{0}''
- Wrong:
Testing your changes
Once you have changed one of these resources, you might want to test your changes. You can:
- Run DBeaver directly from Eclipse workspace
Build DBeaver from source and run executable
Pull request guidelines
- Please avoid creating multiple pull requests for one issue.
Avoid force-pushing the commits in the PR branch. This makes reading commit history more complex.
Localization proposals
Brazilian Portuguese Standardization proposals by @brlarini