Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Commit

Permalink
Merge pull request #126 from tofi86/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
tofi86 committed Feb 4, 2023
2 parents 8bcbdba + 404f5c1 commit cd2d3c3
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 23 deletions.
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [3.3.0] - 2023-02-04

PLEASE NOTE: This is the last official release as I'm going to sunset this project for personal reasons.

### Added
- Support country specific locales such as Brazilian Portuguese (`pt-BR`)
- Translation of messages to Brazilian Portuguese (#115, Thanks to @israelins85 for his contribution)

### Changed
- Changed Adopt OpenJDK link and name to Adoptium

### Removed
- Option to fund this project


## [3.2.0] - 2021-02-21
### Added
- Also expand variables `$APP_PACKAGE`, `$JAVAROOT` and `$USER_HOME` in Oracle style PList files
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014-2021 Tobias Fischer
Copyright (c) 2014-2023 Tobias Fischer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
universalJavaApplicationStub
============================

![Tests and Shellcheck](https://github.com/tofi86/universalJavaApplicationStub/workflows/Tests%20and%20Shellcheck/badge.svg) [![Current release](https://img.shields.io/github/release/tofi86/universalJavaApplicationStub.svg)](https://github.com/tofi86/universalJavaApplicationStub/releases) [![Donate to this project using Buy Me A Coffee](https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg)](https://ko-fi.com/tofi86)
![Tests and Shellcheck](https://github.com/tofi86/universalJavaApplicationStub/workflows/Tests%20and%20Shellcheck/badge.svg) [![Current release](https://img.shields.io/github/release/tofi86/universalJavaApplicationStub.svg)](https://github.com/tofi86/universalJavaApplicationStub/releases)

A BASH based _launcher stub_ for Java based macOS Apps that works with both Apple's and Oracle's plist format. It is released under the [MIT License](https://github.com/tofi86/universalJavaApplicationStub/blob/master/LICENSE).

Expand All @@ -11,8 +11,6 @@ A BASH based _launcher stub_ for Java based macOS Apps that works with both Appl

🤔 ❓ If you have a _general question_ about how a feature works or would like to _share an idea_ or a _usecase for this project_, then please use the [GitHub Discussions Page](https://github.com/tofi86/universalJavaApplicationStub/discussions).

❤️ ☕ If you want to support this independent project, you can buy me a coffee: [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/tofi86)


Why
---
Expand Down
56 changes: 38 additions & 18 deletions src/universalJavaApplicationStub
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
# #
# @author Tobias Fischer #
# @url https://github.com/tofi86/universalJavaApplicationStub #
# @date 2021-02-21 #
# @version 3.2.0 #
# @date 2023-02-04 #
# @version 3.3.0 #
# #
##################################################################################
# #
# The MIT License (MIT) #
# #
# Copyright (c) 2014-2021 Tobias Fischer #
# Copyright (c) 2014-2023 Tobias Fischer #
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy #
# of this software and associated documentation files (the "Software"), to deal #
Expand Down Expand Up @@ -344,7 +344,7 @@ done
############################################

# supported languages / available translations
stubLanguages="^(fr|de|zh|es|en)-"
stubLanguages=("de" "en" "es" "fr" "pt-BR" "zh")

# read user preferred languages as defined in macOS System Preferences (#101)
stub_logger '[LanguageSearch] Checking preferred languages in macOS System Preferences...'
Expand All @@ -355,15 +355,19 @@ language=""
for i in "${appleLanguages[@]}"
do
langValue="${i%-*}"
if [[ "$i" =~ $stubLanguages ]]; then
stub_logger "[LanguageSearch] ... selected '$i' ('$langValue') as the default language for the launcher stub"
if [[ " ${stubLanguages[*]} " =~ " ${i} " ]]; then
stub_logger "[LanguageSearch] ... selected '$i' as the default language for the launcher stub"
language=${i}
break
elif [[ " ${stubLanguages[*]} " =~ " ${langValue} " ]]; then
stub_logger "[LanguageSearch] ... selected '$langValue' (from '$i') as the default language for the launcher stub"
language=${langValue}
break
break
fi
done
if [ -z "${language}" ]; then
language="en"
stub_logger "[LanguageSearch] ... selected fallback 'en' as the default language for the launcher stub"
language="en"
stub_logger "[LanguageSearch] ... selected fallback 'en' as the default language for the launcher stub"
fi
stub_logger "[Language] $language"

Expand All @@ -382,7 +386,7 @@ fr)
MSG_INSTALL_JAVA="Java doit être installé sur votre système.\nRendez-vous sur java.com et suivez les instructions d'installation..."
MSG_LATER="Plus tard"
MSG_VISIT_JAVA_DOT_COM="Java by Oracle"
MSG_VISIT_ADOPTOPENJDK="Java by AdoptOpenJDK"
MSG_VISIT_ADOPTIUM="Java by Adoptium"
;;

# German
Expand All @@ -398,7 +402,7 @@ de)
MSG_INSTALL_JAVA="Auf Ihrem System muss die 'Java'-Software installiert sein.\nBesuchen Sie java.com für weitere Installationshinweise."
MSG_LATER="Später"
MSG_VISIT_JAVA_DOT_COM="Java von Oracle"
MSG_VISIT_ADOPTOPENJDK="Java von AdoptOpenJDK"
MSG_VISIT_ADOPTIUM="Java von Adoptium"
;;

# Simplified Chinese
Expand All @@ -414,7 +418,7 @@ zh)
MSG_INSTALL_JAVA="你需要在Mac中安装Java运行环境!\n访问 java.com 了解如何安装。"
MSG_LATER="稍后"
MSG_VISIT_JAVA_DOT_COM="Java by Oracle"
MSG_VISIT_ADOPTOPENJDK="Java by AdoptOpenJDK"
MSG_VISIT_ADOPTIUM="Java by Adoptium"
;;

# Spanish
Expand All @@ -430,9 +434,25 @@ es)
MSG_INSTALL_JAVA="¡Necesita tener JAVA instalado en su Mac!\nVisite java.com para consultar las instrucciones para su instalación..."
MSG_LATER="Más tarde"
MSG_VISIT_JAVA_DOT_COM="Java de Oracle"
MSG_VISIT_ADOPTOPENJDK="Java de AdoptOpenJDK"
MSG_VISIT_ADOPTIUM="Java de Adoptium"
;;

# Brazilian Portuguese
pt-BR)
MSG_ERROR_LAUNCHING="ERRO iniciando '${CFBundleName}'."
MSG_MISSING_MAINCLASS="'MainClass' não foi definida!\nA aplicação java não poderá ser iniciada!"
MSG_JVMVERSION_REQ_INVALID="A sintaxe da versão Java requerida não é valida: %s\nPor favor contacte o desenvolvedor dessa aplicação."
MSG_NO_SUITABLE_JAVA="Não foi encontrado uma versão Java compatível no seu sistema!\nEsta aplicação precisa do Java %s"
MSG_JAVA_VERSION_OR_LATER="ou maior"
MSG_JAVA_VERSION_LATEST="(última atualização)"
MSG_JAVA_VERSION_MAX="máxima %s"
MSG_NO_SUITABLE_JAVA_CHECK="Verifique se instalou a versão Java necessária."
MSG_INSTALL_JAVA="Você precisa instalar o JAVA no seu Mac!\nPor favor, visite java.com para instruções de instalação..."
MSG_LATER="Depois"
MSG_VISIT_JAVA_DOT_COM="Java por Oracle"
MSG_VISIT_ADOPTIUM="Java por Adoptium"
;;

# English | default
en|*)
MSG_ERROR_LAUNCHING="ERROR launching '${CFBundleName}'."
Expand All @@ -446,7 +466,7 @@ en|*)
MSG_INSTALL_JAVA="You need to have JAVA installed on your Mac!\nVisit java.com for installation instructions..."
MSG_LATER="Later"
MSG_VISIT_JAVA_DOT_COM="Java by Oracle"
MSG_VISIT_ADOPTOPENJDK="Java by AdoptOpenJDK"
MSG_VISIT_ADOPTIUM="Java by Adoptium"
;;
esac

Expand Down Expand Up @@ -812,21 +832,21 @@ if [ -z "${JAVACMD}" ] || [ ! -x "${JAVACMD}" ] ; then
stub_logger "[EXIT 3] ${MSG_NO_SUITABLE_JAVA_EXPANDED}"

# display error message with AppleScript
osascript -e "tell application \"System Events\" to display dialog \"${MSG_ERROR_LAUNCHING}\n\n${MSG_NO_SUITABLE_JAVA_EXPANDED}\n${MSG_NO_SUITABLE_JAVA_CHECK}\" with title \"${CFBundleName}\" buttons {\" OK \", \"${MSG_VISIT_JAVA_DOT_COM}\", \"${MSG_VISIT_ADOPTOPENJDK}\"} default button 1${DialogWithIcon}" \
osascript -e "tell application \"System Events\" to display dialog \"${MSG_ERROR_LAUNCHING}\n\n${MSG_NO_SUITABLE_JAVA_EXPANDED}\n${MSG_NO_SUITABLE_JAVA_CHECK}\" with title \"${CFBundleName}\" buttons {\" OK \", \"${MSG_VISIT_JAVA_DOT_COM}\", \"${MSG_VISIT_ADOPTIUM}\"} default button 1${DialogWithIcon}" \
-e "set response to button returned of the result" \
-e "if response is \"${MSG_VISIT_JAVA_DOT_COM}\" then open location \"https://www.java.com/download/\"" \
-e "if response is \"${MSG_VISIT_ADOPTOPENJDK}\" then open location \"https://adoptopenjdk.net/releases.html\""
-e "if response is \"${MSG_VISIT_ADOPTIUM}\" then open location \"https://adoptium.net/releases.html\""
# exit with error
exit 3

else
# log exit cause
stub_logger "[EXIT 1] ${MSG_ERROR_LAUNCHING}"
# display error message with AppleScript
osascript -e "tell application \"System Events\" to display dialog \"${MSG_ERROR_LAUNCHING}\n\n${MSG_INSTALL_JAVA}\" with title \"${CFBundleName}\" buttons {\"${MSG_LATER}\", \"${MSG_VISIT_JAVA_DOT_COM}\", \"${MSG_VISIT_ADOPTOPENJDK}\"} default button 1${DialogWithIcon}" \
osascript -e "tell application \"System Events\" to display dialog \"${MSG_ERROR_LAUNCHING}\n\n${MSG_INSTALL_JAVA}\" with title \"${CFBundleName}\" buttons {\"${MSG_LATER}\", \"${MSG_VISIT_JAVA_DOT_COM}\", \"${MSG_VISIT_ADOPTIUM}\"} default button 1${DialogWithIcon}" \
-e "set response to button returned of the result" \
-e "if response is \"${MSG_VISIT_JAVA_DOT_COM}\" then open location \"https://www.java.com/download/\"" \
-e "if response is \"${MSG_VISIT_ADOPTOPENJDK}\" then open location \"https://adoptopenjdk.net/releases.html\""
-e "if response is \"${MSG_VISIT_ADOPTIUM}\" then open location \"https://adoptium.net/releases.html\""
# exit with error
exit 1
fi
Expand Down

0 comments on commit cd2d3c3

Please sign in to comment.