Skip to content

Commit

Permalink
Merge branch 'staging' into feat/localize/keyboard-search
Browse files Browse the repository at this point in the history
  • Loading branch information
darcywong00 committed Jan 27, 2025
2 parents 8c156b7 + bdd80bc commit 509165c
Show file tree
Hide file tree
Showing 13 changed files with 165 additions and 133 deletions.
2 changes: 1 addition & 1 deletion .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ RewriteRule "^keyboards/(?!index\.php|install|keyboard|session|share)([^/]+)$" "
# RewriteRule "^keyboards$" "/keyboards/index.php" [L]

# /keyboards/languages to /keyboards/index.php
RewriteRule "^keyboards/languages/(.*)" "/keyboards/index.php?q=l:id:$1" [END]
RewriteRule "^keyboards/languages/(.*)" "/keyboards/index.php?q=l:id:$1" [END,QSA]

# /keyboards/download to /keyboards/download.php
RewriteRule "^keyboards/download(.php)?" "/keyboards/download.php" [END,QSA]
Expand Down
2 changes: 2 additions & 0 deletions _includes/2020/templates/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ private static function render_top_menu(object $fields): void {
<img id="header-bottom" src="<?php echo Util::cdn("img/headerbar.png"); ?>" alt='Header bottom' />
<div id="help">

<span id='free'>Keyman is <a href='/free'>free and open source</a></span>

<form action="/search/" method="get" role="search">
<div class="search-wrap">
<label for="main-q" class="offscreen">Search</label>
Expand Down
93 changes: 56 additions & 37 deletions _includes/includes/ui/keyboard-details.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class KeyboardDetails

/**
* render_keyboard_details - display keyboard download boxes and details
* @param $id - keyboard ID
* @param $id - keyboard package ID
* @param string $tier - ['stable', 'alpha', or 'beta']
* @param bool $landingPage - when true, details won't display keyboard search box or title
* @param string $bcp47 - BCP 47 tag to pass as a hint to download links for apps to make connection
Expand Down Expand Up @@ -125,41 +125,48 @@ protected static function download_box($platform) {
protected static function WriteWebBoxes($useDescription) {
global $embed_target;
global $KeymanHosts;
if (isset(self::$keyboard->platformSupport->desktopWeb) && self::$keyboard->platformSupport->desktopWeb != 'none' && empty(self::$deprecatedBy)) {
if(empty(self::$bcp47)) {
if (isset(self::$keyboard->languages)) {
if (is_array(self::$keyboard->languages)) {
if (count(self::$keyboard->languages) > 0) {
$lang = self::$keyboard->languages[0];
}
} else {
$langs = array_keys(get_object_vars(self::$keyboard->languages));
if (count($langs) > 0) {
$lang = $langs[0];
}

// only show if the jsFilename property is present in the .keyboard_info
if(empty(self::$keyboard->jsFilename)) {
return FALSE;
}

if (!isset(self::$keyboard->platformSupport->desktopWeb) || self::$keyboard->platformSupport->desktopWeb == 'none' || !empty(self::$deprecatedBy)) {
return FALSE;
}

if(empty(self::$bcp47)) {
if (isset(self::$keyboard->languages)) {
if (is_array(self::$keyboard->languages)) {
if (count(self::$keyboard->languages) > 0) {
$lang = self::$keyboard->languages[0];
}
} else {
$langs = array_keys(get_object_vars(self::$keyboard->languages));
if (count($langs) > 0) {
$lang = $langs[0];
}
}
} else {
$lang = self::$bcp47;
}
if (!isset($lang)) $lang = 'en';
$url = "{$KeymanHosts->keymanweb_com}/#$lang,Keyboard_" . self::$keyboard->id;
if($useDescription) {
$description = htmlentities(self::$keyboard->name);
$description = "<div class=\"download-description\">Use $description in your web browser. No need to install anything.</div>";
$linktext = 'Use keyboard online';
} else {
$description = '';
$linktext = 'Full online editor';
}
return <<<END
<div class="download download-web">
<a class="download-link" $embed_target href='$url'>$linktext</a>
$description
</div>
END;
} else {
$lang = self::$bcp47;
}
if (!isset($lang)) $lang = 'en';
$url = "{$KeymanHosts->keymanweb_com}/#$lang,Keyboard_" . self::GetWebKeyboardId();
if($useDescription) {
$description = htmlentities(self::$keyboard->name);
$description = "<div class=\"download-description\">Use $description in your web browser. No need to install anything.</div>";
$linktext = 'Use keyboard online';
} else {
$description = '';
$linktext = 'Full online editor';
}
return FALSE;
return <<<END
<div class="download download-web">
<a class="download-link" $embed_target href='$url'>$linktext</a>
$description
</div>
END;
}

protected static function LoadData() {
Expand All @@ -170,7 +177,7 @@ protected static function LoadData() {
if ($s === FALSE) {
// Will fail later in the script
self::$error .= error_get_last()['message'] . "\n";
self::$title = 'Failed to load keyboard ' . self::$id;
self::$title = 'Failed to load keyboard package ' . self::$id;
header('HTTP/1.0 404 Keyboard not found');
} else {
$s = json_decode($s);
Expand All @@ -184,7 +191,7 @@ protected static function LoadData() {
self::$license = self::map_license(isset(self::$keyboard->license) ? self::$keyboard->license : 'Unknown');
} else {
self::$error .= "Error returned from {$KeymanHosts->api_keyman_com}: $s\n";
self::$title = 'Failed to load keyboard ' . self::$id;
self::$title = 'Failed to load keyboard package ' . self::$id;
header('HTTP/1.0 500 Internal Server Error');
}
}
Expand Down Expand Up @@ -300,7 +307,7 @@ protected static function WriteTitle() {
// If parameters are missing ...
?>
<h1 class='red underline'><?= self::$id ?></h1>
<p>Keyboard <?= self::$id ?> not found.</p>
<p>Keyboard package <?= self::$id ?> not found.</p>
<?php
// DEBUG: Only display errors on local sites
global $KeymanHosts;
Expand Down Expand Up @@ -340,7 +347,6 @@ protected static function WriteTitle() {

if(!empty(self::$deprecatedBy)) {
$dep = self::$deprecatedBy;
$id = self::$id;
echo "
<div>
<a href='/keyboards/$dep$session_query_q' class='deprecated'><span>Important note:</span>
Expand Down Expand Up @@ -393,6 +399,13 @@ protected static function WriteDownloadBoxes() {
}
}

private static function GetWebKeyboardId() {
if(empty(self::$keyboard->jsFilename)) {
return "";
}
return preg_replace("/\.js$/", "", self::$keyboard->jsFilename);
}

protected static function GetWebDeviceFromPageDevice() {
global $pageDevice;
switch($pageDevice) {
Expand All @@ -418,12 +431,18 @@ protected static function WriteKeymanWebBox() {
return;
}

// only show if the jsFilename property is present in the .keyboard_info
if(empty(self::$keyboard->jsFilename)) {
return;
}

// only inject on desktop platforms
$webDevice = self::GetWebDeviceFromPageDevice();
if(!$webDevice) {
return;
}

$keymanWebId = self::GetWebKeyboardId();
$webtext = self::WriteWebBoxes(false);
$cdnUrlBase = KeymanWebHost::getKeymanWebUrlBase();
?>
Expand Down Expand Up @@ -452,7 +471,7 @@ function() {
document.getElementById('osk-host').appendChild(newOSK.element);
}
);
keyman.addKeyboards('<?= self::$id ?>');
keyman.addKeyboards('<?= $keymanWebId ?>');
})();
</script>
<?php
Expand Down
1 change: 1 addition & 0 deletions about/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Keyboard layouts are defined with a clear and easy to understand keyboard gramma
means keyboard layouts can be intelligent and make it simple to type even the most complex languages.
Keyboard layouts are distributed through an open catalog to all major desktop and mobile platforms.

Keyman is [free and open source!](/free)

## About SIL Global

Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## START STANDARD SITE BUILD SCRIPT INCLUDE
readonly THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
readonly BOOTSTRAP="$(dirname "$THIS_SCRIPT")/resources/bootstrap.inc.sh"
readonly BOOTSTRAP_VERSION=v0.11
readonly BOOTSTRAP_VERSION=v0.15
[ -f "$BOOTSTRAP" ] && source "$BOOTSTRAP" || source <(curl -fs https://raw.githubusercontent.com/keymanapp/shared-sites/$BOOTSTRAP_VERSION/bootstrap.inc.sh)
## END STANDARD SITE BUILD SCRIPT INCLUDE

Expand Down
20 changes: 13 additions & 7 deletions cdn/dev/css/template.css
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ html {

.button a {
color: inherit;
text-decoration: none;
text-decoration: none;
align-items: center;
}

Expand Down Expand Up @@ -368,17 +368,17 @@ span.button.disabled{
.version-type {
margin-bottom: 10px;
height: 300px;
width: 30%;
width: 30%;
max-width: 300px;
padding: 10px;
box-sizing: border-box;
box-sizing: border-box;
box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px;
border-radius: 5px;
overflow-y: auto;
overflow-y: auto;
}

.version-type h5 {
opacity: 0.6;
opacity: 0.6;
}

.version-item {
Expand All @@ -388,7 +388,7 @@ span.button.disabled{
.version-item a {
text-decoration: none;
color: #B92034;
display: block;
display: block;
width: 100%;
}

Expand Down Expand Up @@ -530,14 +530,20 @@ span.button.disabled{
text-decoration: none;
}

#help #free {
float: left;
margin-right: 1em;
padding-top: 7px;
}

#help form {
float: left;
}

#help #donate {
padding-top: 5px;
margin-right: 1em;
margin-left: 1em;
margin-left: 0em;
}

#help #donate a {
Expand Down
55 changes: 55 additions & 0 deletions developer/authoring-services.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: Keyboard authoring service directory
---

If you wish to create a keyboard layout but do not have the technical expertise or time to create it yourself, the people and companies listed on this page
may be able to assist you.

---

### Enabling Languages

Advise on layout requirements; developing new keyboard layouts; creating word frequency lists from a corpus; assisting in publishing a completed keyboard to keyboard repository on github; introductory training on using git and github to enable self-publishing.

Contact: [[email protected]](mailto:[email protected])

---

### Katelem Edeh

Creating new keyboards and lexical models.

Contact: [[email protected]](mailto:[email protected])

---

## Request addition to this directory

If you would like to be added to this directory, please complete the following form:

* [Keyboard authoring service signup](https://forms.gle/i7S1Yb5ck4nUr8mn6)

## Disclaimer

The information within Keyboard authoring service directory is provided as a
public service to our community. The information is supplied by independent
third parties.

While SIL Global makes every effort to ensure the accuracy of all the
information, it makes no warranty as to the accuracy or reliability of any such
information, content or other material contained on, distributed through, or
linked, downloaded or accessed through this directory. Any reliance upon any
information, content, materials, products, services included on or found through
this directory shall be at the user’s sole risk.

Listing in this directory does not imply endorsement by SIL Global. Nor does SIL
Global endorse products or services that such listings may offer. SIL Global
disclaims all representations or warranties of any kind, express or implied,
with respect to this directory or the information, content, materials or
products included including, without limitation, warranties of quality.

The directory may include link to external websites. When users click on such
links, they are leaving the Keyman website and are subject to the privacy and
security policies of the owners/sponsors of the external site. SIL Global cannot
authorize the use of copyrighted materials published on linked, external
websites. Users must request authorization from the owners of those websites.
1 change: 1 addition & 0 deletions developer/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<li><a href="features.php">See the features.</a></li>
<li><a href='download.php'>Keyman Developer Downloads</a></li>
<li><a href='<?= KeymanHosts::Instance()->help_keyman_com ?>/developer/<?php echo $stable_version; ?>/'>Keyman Developer Support</a></li>
<li><a href='authoring-services'>Keyboard authoring service providers</a></li>
</ul>

<?php
Expand Down
28 changes: 28 additions & 0 deletions free/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: Keyman is free and open source
---

Keyman is completely free to use on all devices! SIL Global does not charge
any license fees for using Keyman.

* This change took place in August 2017 after SIL Global acquired Keyman from
Tavultesoft Pty Ltd.

# Open Source

Keyman is licensed under the [MIT License](https://github.com/keymanapp/keyman/blob/master/LICENSE.md).
The MIT License is a short, permissive software license. Basically, you can
do whatever you want as long as you include the original copyright and license
notice in any copy of the software/source.

SIL Global have chosen the MIT License in order to provide you, the users of
Keyman with the greatest possible freedom to work in your language.

All 'release' quality Keyman keyboards in the [Keyman keyboard repository](https://github.com/keymanapp/keyboards)
are licensed under the MIT License. All lexical models in the
[Keyman lexical model repository](https://github.com/keymanapp/lexical-models)
are also licensed under the MIT License. Copyright for these keyboards and
lexical models belongs to many different authors.

* [About SIL Global](https://www.sil.org/about)
* [About Keyman](/about)
Loading

0 comments on commit 509165c

Please sign in to comment.