Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
689d15b
feat: Use associate array for strings on keyboard search page
darcywong00 Sep 9, 2025
755a2df
wip: Start implementing review comments
darcywong00 Sep 9, 2025
db8aa79
refactor load strings
darcywong00 Sep 11, 2025
c715fb8
Cleanup fallback of locale
darcywong00 Sep 15, 2025
d446584
refactor callback locales
darcywong00 Sep 16, 2025
79dbb48
chore: more cleanup
darcywong00 Sep 17, 2025
faa45cf
fix: variadric args
darcywong00 Sep 17, 2025
76c9d0a
set lang tag and fallback to English
darcywong00 Sep 18, 2025
b2313a8
simplify some keys
darcywong00 Sep 19, 2025
ab2a5a1
Merge remote-tracking branch 'origin/master' into feat/localize/keybo…
darcywong00 Oct 22, 2025
82c6671
fix: add globe icon for UI selector
darcywong00 Oct 22, 2025
ed1c38b
fix: Update globe to hover
darcywong00 Oct 22, 2025
2fd6527
fix: Parse lang string in URI query
darcywong00 Oct 29, 2025
0bc40f5
refactor render_globe_dropdown()
darcywong00 Oct 30, 2025
54a0de5
chore: Add header to render_globe_dropdown
darcywong00 Oct 30, 2025
c1638ca
die if current locales aren't set
darcywong00 Nov 4, 2025
cacc840
chore: Address review comments
darcywong00 Nov 10, 2025
e94e88f
start to map keyboard details
darcywong00 Sep 17, 2025
3b5fab6
chore: revert es.php
darcywong00 Nov 12, 2025
27617bd
start localizing install page
darcywong00 Nov 3, 2025
e844b13
feat: Localize share keyboard page
darcywong00 Nov 5, 2025
6850a23
fix: append query string for share
darcywong00 Nov 17, 2025
c1cfe0a
Apply suggestions from code review
darcywong00 Nov 19, 2025
8030237
rename to keyboard-details/
darcywong00 Nov 19, 2025
8ce8e0b
add boilerplate for _m wrappers
darcywong00 Nov 19, 2025
a8d4b92
Merge branch 'feat/localize/keyboard-details-map' into feat/localize/…
darcywong00 Nov 19, 2025
a5833d8
Rename domain to keyboards/details
darcywong00 Nov 19, 2025
4a47c61
Merge branch 'feat/localize/keyboard-details-map' into feat/localize/…
darcywong00 Nov 19, 2025
d39dd3d
add more formatted strings
darcywong00 Nov 19, 2025
3c68e9f
fix vprintf with 2+ params
darcywong00 Nov 19, 2025
b613c11
Merge branch 'feat/localize/keyboard-details-map' into feat/localize/…
darcywong00 Nov 19, 2025
b4e1e19
move share/install into keyboards/
darcywong00 Nov 19, 2025
216c820
Refactor install page
darcywong00 Nov 19, 2025
60a6abb
Refactor share
darcywong00 Nov 20, 2025
801a33c
maint: emit broken-link-checker logs before summarizing
mcdurdin Nov 25, 2025
491661c
Merge pull request #624 from keymanapp/maint/link-check-logs
mcdurdin Nov 25, 2025
6206dc8
chore: refactor tests
darcywong00 Apr 28, 2025
de685fd
chore: cleanup
darcywong00 Nov 26, 2025
f989eba
chore: update BOOTSTRAP_VERSION to v1.08
keyman-server Nov 26, 2025
b385a73
Merge pull request #625 from keymanapp/auto/update-bootstrap-version-…
keyman-status Nov 26, 2025
068ffbe
Merge remote-tracking branch 'origin/master' into chore/clean-compose…
darcywong00 Nov 26, 2025
7ac0025
chore: update README
darcywong00 Nov 27, 2025
c3f1c8a
redirect access to /tests
darcywong00 Nov 27, 2025
c367548
Merge pull request #578 from keymanapp/chore/clean-composer-scripts
darcywong00 Nov 28, 2025
75abde9
Merge branch 'master' into feat/localize/keyboards-map
darcywong00 Nov 28, 2025
f1f8a62
fix: Pass div number for render_globe_dropdown()
darcywong00 Dec 1, 2025
4fe6b0c
test: exclude link-checking locales 'lang=*'
darcywong00 Dec 1, 2025
0e1b284
Merge pull request #604 from keymanapp/feat/localize/keyboards-map
darcywong00 Dec 3, 2025
8483fda
Merge branch 'master' into feat/localize/keyboard-details-map
darcywong00 Dec 3, 2025
b161eb8
Merge pull request #622 from keymanapp/feat/localize/keyboard-details…
darcywong00 Dec 3, 2025
d762777
Merge branch 'master' into feat/localize/keyboards-share
darcywong00 Dec 3, 2025
54e803e
Limit globe button visibility to /keyboards/ pages
darcywong00 Dec 3, 2025
29db0fa
Apply suggestions from code review
darcywong00 Dec 3, 2025
dd1f51d
chore: rename constant
darcywong00 Dec 3, 2025
f67458b
Use _m rename
darcywong00 Dec 4, 2025
a0da12e
Also use _m in share.php
darcywong00 Dec 4, 2025
5a8dc4e
refactor to use definePageLocale
darcywong00 Dec 4, 2025
f46c730
change: tweak signup form and link to blog subscribe page
mcdurdin Dec 4, 2025
ca3ce8e
Merge pull request #626 from keymanapp/feat/localize/globe-on-keyboard
darcywong00 Dec 4, 2025
c20386f
Merge branch 'master' into feat/localize/keyboards-share
darcywong00 Dec 4, 2025
814466d
use `Locale::definePageLocale()` on install and share pages
darcywong00 Dec 4, 2025
14007af
Merge pull request #623 from keymanapp/feat/localize/keyboards-share
darcywong00 Dec 4, 2025
161a50c
change: update last name for Joshua Prins-Horton
jahorton Dec 4, 2025
8a60e84
Merge pull request #628 from keymanapp/change/jph-last-name
darcywong00 Dec 5, 2025
95094b4
Merge pull request #627 from keymanapp/change/signup
darcywong00 Dec 5, 2025
a1dd045
Merge branch 'staging' into auto/A19S17-merge-master-into-staging
keyman-server Dec 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,47 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3.5.2
uses: actions/checkout@v4.1.5

- name: Build the docker image for keyman.com app
shell: bash
run: |
echo "TIER_TEST" > tier.txt
./build.sh build start
./build.sh configure build start --debug
env:
fail-fast: true

#
# Finally, run the tests
#
- name: PHP test
shell: bash
run: |
docker exec keyman-com-app sh -c "vendor/bin/phpunit --testdox"

- name: Lint
shell: bash
run: |
( set +e; set +o pipefail; find . -name '*.php' | grep -v '/vendor/' | xargs -n 1 -d '\n' php -l | grep -v "No syntax errors detected"; exit ${PIPESTATUS[2]} )

- name: Check broken links
shell: bash
continue-on-error: false
# Exclude checking locales for each link 'lang=*'
run: |
set +e
set +o pipefail
npx broken-link-checker http://localhost:8053/_test --recursive --ordered ---host-requests 50 -e --filter-level 3 --exclude '*/donate' --exclude '*lang=*' | tee blc.log
echo "BLC_RESULT=${PIPESTATUS[0]}" >> "$GITHUB_ENV"

- name: Report on broken links
run: |
set +e;
set +o pipefail;
npx broken-link-checker http://localhost:8053/_test --ordered --recursive --host-requests 50 -e --filter-level 3 --exclude '*/donate' | \
set +e
set +o pipefail
cat blc.log | \
grep -E "BROKEN|Getting links from" | \
grep -B 1 "BROKEN"
exit ${PIPESTATUS[0]}
grep -B 1 "BROKEN";
exit "${BLC_RESULT}"

- name: Check PHP errors
shell: bash
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ cdn/deploy/

tier.txt

# unit test artifacts
blc.log
.phpunit.result.cache

vendor*
/node_modules/

Expand Down
5 changes: 4 additions & 1 deletion .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ RewriteRule "^(macosx|macos)\b(.*)$" "/mac$2" [NC,R=301,END,QSA]
# Redirect deprecated Google Plus link
RewriteRule "^plus.*" "/" [NC,R=301,END,QSA]

# Redirect PHP unit tests
RewriteRule "^tests(\/.*)?" "/" [NC,R=301,END,QSA]

# /donate -> donate.keyman.com
RedirectMatch 301 "^(?i)/donate(\/.*)?" "https://donate.keyman.com"

Expand Down Expand Up @@ -93,7 +96,7 @@ RewriteRule "^keyboards/download/([^/]+)$" "/keyboards/keyboard.php?id=$1" [END,

# /keyboards/share/[id] to /keyboards/share.php
# if the keyboard exists in the repo, then share.php will redirect to /keyboards/<id>
RewriteRule "^keyboards/share/([^/]+)$" "/keyboards/share.php?id=$1" [END]
RewriteRule "^keyboards/share/([^/]+)$" "/keyboards/share.php?id=$1" [END,QSA]

# /keyboards/{id}.json to /keyboards/keyboard.json.php
RewriteRule "^keyboards/(?!keyboard.json)(.*)\.json$" "/keyboards/keyboard.json.php?id=$1" [END]
Expand Down
11 changes: 10 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# syntax=docker/dockerfile:1

ARG BUILDER_CONFIGURATION="release"
FROM php:7.4-apache@sha256:c9d7e608f73832673479770d66aacc8100011ec751d1905ff63fae3fe2e0ca6d AS composer-builder

# Install Zip to use composer
Expand All @@ -15,7 +17,14 @@ RUN composer self-update
USER www-data
WORKDIR /composer
COPY composer.* /composer/
RUN composer install
# Consume the build argment
ARG BUILDER_CONFIGURATION
RUN if [ "$BUILDER_CONFIGURATION" = "debug" ]; then \
# composer install --dev deprecated
COMPOSER_NO_DEV=0 composer install ; \
else \
COMPOSER_NO_DEV=1 composer install ; \
fi

# Site
FROM php:7.4-apache@sha256:c9d7e608f73832673479770d66aacc8100011ec751d1905ff63fae3fe2e0ca6d
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ shell, and from this folder, run:
./build.sh build
```

If you'll be running tests locally, the Docker image will need to be built with dev dependencies:

```sh
./build.sh build --debug
```

#### Start the Docker container

To start up the website, in bash, run:
Expand Down Expand Up @@ -81,7 +87,11 @@ In bash, run:

#### Running tests

To check for broken links and .php file conformance, when the site is running,
When the site is running, the test action will do the following:
* PHP unit tests
* Check .php file conformance
* Check for internal broken links

in bash, run:

```sh
Expand Down
1 change: 1 addition & 0 deletions _includes/2020/templates/Foot.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ static function render(array $fields = []) {
</div>
<!--End mc_embed_signup-->
<br>
<div id="low-frequency">Receive updates 3-4 times/year, or you can<br><a href="https://blog.keyman.com/subscribe/">get regular updates</a> every 2 weeks</div>
<div id="privacy-policy"><a href="/privacy/">Privacy policy</a></div>

<div id='footer-get-involved'>
Expand Down
63 changes: 63 additions & 0 deletions _includes/2020/templates/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,63 @@ public static function render(array $fields): void {
Menu::render_top_menu($fields);
}

/**
* Generate the URL with query to change the UI language
* @param language - language tag to use
*/
private static function change_ui_language($language): string {
// Parse the current URI for populating the UI dropdown
$url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
$parts = parse_url($url);

if (!empty($parts['query'])) {
parse_str($parts['query'], $queryParams);
} else {
$queryParams = [];
}

// Set the language query
$queryParams['lang'] = $language;
$query = http_build_query($queryParams);

return $parts['path'] . "?" . $query;
}

/**
* Render the globe dropdown for changing the UI language
* As UI languages get added, we'll need to update this.
* Limitation: Currently only visible on pages that use localized strings
* @param number - Div number, default 0.
*/
private static function render_globe_dropdown($number = 0): void {
global $page_is_using_locale;
if (!isset($page_is_using_locale) || !$page_is_using_locale) {
// only render on pages that use localized strings
return;
}

$divID = ($number == 1) ? "ui-language1" : "ui-language";
echo <<<END
<p>
<div id='$divID' class="menu-item">
END;
?>
<img src="<?php echo Util::cdn("img/globe.png"); ?>" alt="UI globe dropdown" />
<div class="menu-item-dropdown">
<div class="menu-dropdown-inner">
<ul>
<!-- Just use autonyms -->
<li><a href="<?= Menu::change_ui_language('en'); ?>">English</a></li>
<li><a href="<?= Menu::change_ui_language('es'); ?>">Español</a></li>
<li><a href="<?= Menu::change_ui_language('fr'); ?>">Français</a></li>
</ul>
</div>
</div>
</div>
</p>
<?php
}

private static function render_phone_menu(object $fields): void {
?>

Expand Down Expand Up @@ -117,6 +174,9 @@ private static function render_top_menu(object $fields): void {
</form>
<p id="donate"><a href="/donate">Donate</a></p>
<p><a href="<?= KeymanHosts::Instance()->help_keyman_com ?>" target="blank">Support<img src="<?php echo Util::cdn("img/helpIcon.png"); ?>" alt="help icon"></a></p>
<?php
Menu::render_globe_dropdown();
?>
</div>
</div>
<div id="top-menu-bg"></div>
Expand All @@ -132,6 +192,9 @@ private static function render_top_menu(object $fields): void {
</form>
<a id='help1-donate' href="/donate">Donate</a>
<a href="<?= KeymanHosts::Instance()->help_keyman_com ?>"><img id="top-menu-icon2" src="<?php echo Util::cdn("img/helpIcon.png"); ?>" alt="help icon" /></a>
<?php
Menu::render_globe_dropdown(1);
?>
</div>
<div class="wrapper">
<div class="menu-item" id="keyboards">
Expand Down
6 changes: 5 additions & 1 deletion _includes/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
if(preg_match('/^Keyman\\\\Site\\\\com\\\\keyman\\\\(.+)/', $class_name, $matches)) {
// Fix namespace pathing for Linux
$filename = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $matches[1]);
$success = include(__DIR__ . "/2020/{$filename}.php");
if ($filename == 'Locale') {
$success = include(__DIR__ . "/locale/{$filename}.php");
} else {
$success = include(__DIR__ . "/2020/{$filename}.php");
}
if($success === FALSE) {
debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
die("Unable to find class $class_name");
Expand Down
3 changes: 3 additions & 0 deletions _includes/includes/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@

// *Don't* use autoloader here because of potential side-effects in older pages
require_once(__DIR__ . '/../2020/Util.php');
require_once(__DIR__ . '/../locale/Locale.php');
require_once(__DIR__ . '/../../_common/KeymanVersion.php');
require_once(__DIR__ . '/../2020/templates/Head.php');

use Keyman\Site\com\keyman\Locale;

function template_finish($foot) {
//ob_end_flush();

Expand Down
Loading