Use language.php instead of dummy (only english) language #252

Merged
RoukePouw merged 2 commits from Issue/94-Installing-from-git-shows-only-the-English-language into master 2020-03-04 06:59:37 +00:00
RoukePouw commented 2019-06-18 07:50:50 +00:00 (Migrated from github.com)

Fixes #94

Place languages in separate json data file

Fixes #94 Place languages in separate json data file
matthijskooijman (Migrated from github.com) requested changes 2019-06-18 10:26:47 +00:00
matthijskooijman (Migrated from github.com) left a comment

I left a few comments inline that can further simplify the code more.

I left a few comments inline that can further simplify the code more.
@ -87,3 +87,3 @@
if ($file != "." && $file != "..") {
if (isAllowedFile($dir.'/'.$file)) $index[ltrim($dir.'/'.$file, "./")] = filemtime($dir.'/'.$file);
if (isAllowedFile($dir.'/'.$file)) $index[preg_replace("/^\.\//i","",$dir.'/'.$file)] = filemtime($dir.'/'.$file);
elseif (is_dir($dir.'/'.$file)) $index = array_merge($index, index($dir.'/'.$file));
matthijskooijman (Migrated from github.com) commented 2019-06-18 10:13:56 +00:00

I think this change is unrelated to the rest of the commit (IIRC it fixes installation of the .htaccess file?). Would be better to have this in a separate commit (separate PR is not needed).

I think this change is unrelated to the rest of the commit (IIRC it fixes installation of the .htaccess file?). Would be better to have this in a separate commit (separate PR is not needed).
matthijskooijman (Migrated from github.com) commented 2019-06-18 10:14:56 +00:00

Why do we still need this replacement? Isn't the content of languages.json valid json as-is?

Why do we still need this replacement? Isn't the content of `languages.json` valid json as-is?
matthijskooijman (Migrated from github.com) commented 2019-06-18 10:26:14 +00:00

Ah, it seems these \' is present in the languages.json file you added. These were probably needed when the json was contained in a PHP '' string, but this is no longer relevant. I would rather remove these backslashes from the languages.json file and remove the replacement above.

Ah, it seems these `\'` is present in the `languages.json` file you added. These were probably needed when the json was contained in a PHP `''` string, but this is no longer relevant. I would rather remove these backslashes from the `languages.json` file and remove the replacement above.
matthijskooijman (Migrated from github.com) commented 2019-06-18 10:17:21 +00:00

Shouldn't this have a case for languages.json rather than language.php now? And that could just return the file_get_contents() for the existing languages.json?

Shouldn't this have a case for `languages.json` rather than `language.php` now? And that could just return the `file_get_contents()` for the existing `languages.json`?
matthijskooijman (Migrated from github.com) commented 2019-06-18 10:18:37 +00:00

Do we need this check and else? AFAICS we always have a languages.json whenever languages.php also exists, so we could just remove the if?

Do we need this check and else? AFAICS we always have a `languages.json` whenever `languages.php` also exists, so we could just remove the if?
matthijskooijman (Migrated from github.com) reviewed 2019-06-18 10:32:08 +00:00
@ -87,3 +87,3 @@
if ($file != "." && $file != "..") {
if (isAllowedFile($dir.'/'.$file)) $index[ltrim($dir.'/'.$file, "./")] = filemtime($dir.'/'.$file);
if (isAllowedFile($dir.'/'.$file)) $index[preg_replace("/^\.\//i","",$dir.'/'.$file)] = filemtime($dir.'/'.$file);
elseif (is_dir($dir.'/'.$file)) $index = array_merge($index, index($dir.'/'.$file));
matthijskooijman (Migrated from github.com) commented 2019-06-18 10:32:08 +00:00

This commit could probably be set to close #92.

This commit could probably be set to close #92.
matthijskooijman (Migrated from github.com) reviewed 2020-01-04 21:05:47 +00:00
@ -87,3 +87,3 @@
if ($file != "." && $file != "..") {
if (isAllowedFile($dir.'/'.$file)) $index[ltrim($dir.'/'.$file, "./")] = filemtime($dir.'/'.$file);
if (isAllowedFile($dir.'/'.$file)) $index[preg_replace("/^\.\//i","",$dir.'/'.$file)] = filemtime($dir.'/'.$file);
elseif (is_dir($dir.'/'.$file)) $index = array_merge($index, index($dir.'/'.$file));
matthijskooijman (Migrated from github.com) commented 2020-01-04 21:05:47 +00:00

This comment is still unresolved.

This comment is still unresolved.
matthijskooijman (Migrated from github.com) reviewed 2020-01-04 21:07:09 +00:00
matthijskooijman (Migrated from github.com) commented 2020-01-04 21:07:09 +00:00

This is resolved.

This is resolved.
matthijskooijman (Migrated from github.com) reviewed 2020-01-04 21:07:50 +00:00
matthijskooijman (Migrated from github.com) commented 2020-01-04 21:07:50 +00:00

This is resolved.

This is resolved.
matthijskooijman (Migrated from github.com) reviewed 2020-01-04 21:08:45 +00:00
matthijskooijman (Migrated from github.com) commented 2020-01-04 21:08:45 +00:00

This is partly resolved, but I'll add a new comment for what's left.

This is partly resolved, but I'll add a new comment for what's left.
matthijskooijman (Migrated from github.com) requested changes 2020-01-04 21:16:51 +00:00
matthijskooijman (Migrated from github.com) left a comment

There is still one unresolved comment from before, and I added one new comment. Otherwise this looks good.

The commit structure does need some cleanup, since there are now multiple duplicate commits and a merge commit, but that can just be a matter of using github's squash and merge (or something like that) feature when merging.

There is still one unresolved comment from before, and I added one new comment. Otherwise this looks good. The commit structure does need some cleanup, since there are now multiple duplicate commits and a merge commit, but that can just be a matter of using github's squash and merge (or something like that) feature when merging.
matthijskooijman (Migrated from github.com) commented 2020-01-04 21:15:31 +00:00

This now returns the decoded json (e.g. a PHP array), whereas the version that is generated when packing up hypha has this section replaced with actual file data, so that changes the return value. IOW, when you pack up hypha, the code no longer works.

To fix that, this should just return the result of file_get_contents(), and the json_decode() should be moved to the caller of data() elsewhere. Might be good to also test this packing up (though I'm not 100% sure it is working in master).

This now returns the decoded json (e.g. a PHP array), whereas the version that is generated when packing up hypha has this section replaced with actual file data, so that changes the return value. IOW, when you pack up hypha, the code no longer works. To fix that, this should just return the result of `file_get_contents()`, and the `json_decode()` should be moved to the caller of `data()` elsewhere. Might be good to also test this packing up (though I'm not 100% sure it is working in master).
laurensmartina (Migrated from github.com) reviewed 2020-01-06 16:40:02 +00:00
laurensmartina (Migrated from github.com) commented 2020-01-06 16:40:02 +00:00

fixed

fixed
laurensmartina (Migrated from github.com) reviewed 2020-01-06 16:55:46 +00:00
@ -87,3 +87,3 @@
if ($file != "." && $file != "..") {
if (isAllowedFile($dir.'/'.$file)) $index[ltrim($dir.'/'.$file, "./")] = filemtime($dir.'/'.$file);
if (isAllowedFile($dir.'/'.$file)) $index[preg_replace("/^\.\//i","",$dir.'/'.$file)] = filemtime($dir.'/'.$file);
elseif (is_dir($dir.'/'.$file)) $index = array_merge($index, index($dir.'/'.$file));
laurensmartina (Migrated from github.com) commented 2020-01-06 16:55:46 +00:00

done

done
matthijskooijman (Migrated from github.com) approved these changes 2020-01-20 10:50:16 +00:00
matthijskooijman (Migrated from github.com) left a comment

Looks good to merge now. I think this PR will conflict with #280. Probably easy enough to fix, but I'll leave it to @laurensmartina to resolve the conflict and see whether to merge this one first, or first #280 and then fixing this one (might be slightly easier).

Looks good to merge now. I think this PR will conflict with #280. Probably easy enough to fix, but I'll leave it to @laurensmartina to resolve the conflict and see whether to merge this one first, or first #280 and then fixing this one (might be slightly easier).
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
harmen/hypha!252
No description provided.