Missing translation feature

Hello there!!

In this discussion, I will be sharing the lines of code I have found that Gibbon is missing its translation feature…

Filename: \modules\User Admin\role_manage_add.php
Line: 88

Code:
$row->addLabel(‘restriction’, __(‘Restriction’))->description(‘Determines who can grant or remove this role in Manage Users.’);

It should be:
$row->addLabel(‘restriction’, (‘Restriction’))->description((‘Determines who can grant or remove this role in Manage Users.’));

I found another in the file livevalidation_standalone.compressed.js

alert(“This form has not been correctly filled. Please scroll up and fix any errors indicated in red.”);

I’m not sure if Gibbon has a build-in feature for the translation of JavaScript strings.

Hi Manuel, thanks for these. I’ve fixed the issue in Add Role, which you can see here. The javascript translation is trickier. We are ideally looking to move to a different validation library in the coming versions, so this may be best addressed in a future version, rather than editing the livevalidation_standalone.compressed.js file.

Awesome! I will be recommending later a JavaScript library for you guys to consider…

I found another page with a missing translation feature.

Filename: /modules/User Admin/role_manage_edit.php

// English value and shown in the Edit form in English

Line #69:
$row->addTextField(‘category’)->required()->readonly()->setValue($role[‘category’]);

Line #76
$row->addTextField(‘name’)->required()->maxLength(20)->readonly($isReadOnly)->setValue($role[‘name’]);

Line #110
$row->addTextField(‘restriction’)->required()->readonly()->setValue(‘Admin Only’);

Right now, these values are coming from the DB and showing as hard-coded values. If in the role_manage_editProcess.php file these fields that are NOT important, then this can be fixed easily because add __() to these readOnly Textfields. But if the values must stay in English, they this cannot be done this way.

Also:
there is no entry for a translation string for “Admin only” in Poeditor.
There is in fact an entry or: “Administrators only”

Hi Manuel, well spotted! These aren’t as easy to catch for English users of the system, so we appreciate you finding and sharing them. I’ve made a fix in v24, which can be found here: https://github.com/GibbonEdu/core/commit/85a8d9752d9003895e6f2a5549852197ef8242b7 The workaround is to pass the database value as a hidden value, and display the translated string. Thanks!

We have two similar phrases in the Gibbon core files:

Year Group at Entry — Year Group of Entry

One does have a translation entry in POEditor, the other does not.
the phrase Year Group of Entry, only appears in studentApplicationForm.yml

We need to either add this phrase to the translation strings, or change it to the phrase that does appear in POEditor.

Thanks, it’s fixed now in v24: https://github.com/GibbonEdu/core/commit/3e0453aa8c4828774e2eed4938f23d99c8aab1d5

Hello Sandra,

I apologize for using this method (I really am working toward learning how to GitHub for a better collaboration)… Very soon!! But until then… I’ll keep sharing via ask.gibbon these suggestions…

Another file that needs a translation feature:

// Filename: modules\Students\student_view_details.php
Lines 699-701

Old code:
$col->addColumn(‘languageFirst’, __(‘First Language’));
$col->addColumn(‘languageSecond’, __(‘Second Language’));
$col->addColumn(‘languageThird’, __(‘Third Language’));
Fixed code:
$col->addColumn(‘languageFirst’, __(‘First Language’))->translatable();
$col->addColumn(‘languageSecond’, __(‘Second Language’))->translatable();
$col->addColumn(‘languageThird’, __(‘Third Language’))->translatable();

Thanks Manuel, much appreciated. It’s fixed here: https://github.com/GibbonEdu/core/commit/31ba26f1616d0490c927c403b5f138989f9486c5

For GitHub, you may not need to go as far as setting up everything locally, the web interface can be useful for small changes. You could navigate to the file from the core https://github.com/GibbonEdu/core and then use the edit button, which has an interface at the bottom for making a commit and a PR : )

Awesome! Thanks!