multiwebinc

multiwebinc

Member Since 10 years ago

Costa Rica

Experience Points
11
follower
Lessons Completed
0
follow
Best Reply Awards
62
repos
Activity
Dec
16
1 month ago
Dec
14
1 month ago
pull request

multiwebinc pull request wintercms/wn-translate-plugin

multiwebinc
multiwebinc

Prevent empty strings from being imported

Proposed fix for #16

Activity icon
issue

multiwebinc issue wintercms/wn-translate-plugin

multiwebinc
multiwebinc

Message exporting and importing creates empty messages

Steps to reproduce:

  1. Make sure you have at least one language in "Manage languages" and set it as default. I added en and es.
  2. If there are no messages, under "Translate messages", scan for messages to add new messages.
  3. Export messages to CSV file and save the file. This file should have the columns, code, default, en, and es.
  4. Import CSV file and select "Auto match columns"

The imported messages will have a message_data JSON object that contains empty strings.

Example actual value:

{"x":"Welcome to my blog.","en":"","es":""}

Expected value:

{"x":"Welcome to my blog."}

This is a problem because if the cache is ever cleared (Translate messages > Clear cache), empty strings will be outputted to the page instead of the default value.

Dec
9
1 month ago
Activity icon
issue

multiwebinc issue comment wintercms/wn-translate-plugin

multiwebinc
multiwebinc

Scanner does not match plurals, and other filters

Checking the source, the processStandardTags() method seems to do a few regex matches to find translatable strings, however, it doesn't match for these filters:

__ (double underscore) transRaw transRawPlural localeUrl

I haven't tested it extensively, however this regex appears to work for me (I have about 400 strings):

{{\s*(["'])((?:(?:(?!\1)).)+)\1\s*[|]\s*(?:_{1,2}|transRaw(?:Plural)?|localeUrl)\s*(?:\([^\)]+\)\s*)?}}

Here's the PHP:

    protected function processStandardTags($content)
    {
        preg_match_all('#{{\s*(["\'])((?:(?:(?!\1)).)+)\1\s*[|]\s*(?:_{1,2}|transRaw(?:Plural)?|localeUrl)\s*(?:\([^\)]+\)\s*)?}}#', $content, $match);
        return $match[2] ?? [];
    }
multiwebinc
multiwebinc

@LukeTowers

Do those functions all support message translations?

I'm not sure I understand your question. The regex above should handle the 4 regexes currently used, plus also the other filters listed in my post.

Also what do you mean by "using Twig's built-in functions to do this instead"?

Well I mean, Twig already parses the files for many things, including the translation filters. So I'm wondering if there would be some sort of functionality in the Twig library that could be used to find all occurrences of a particular filter being used.

Activity icon
issue

multiwebinc issue comment wintercms/wn-translate-plugin

multiwebinc
multiwebinc

Make sure tables don't exist before creating them in migrations

See #13

multiwebinc
multiwebinc

@LukeTowers Fair enough. However, you might still want to take a look at the change to updates/v1.3.1/add_sort_order.php here, even if you don't merge the other changes.

Activity icon
issue

multiwebinc issue comment wintercms/wn-translate-plugin

multiwebinc
multiwebinc

Need installation/migration instructions

I was previously using rainlab/translate (I believe v1.8.7), but I wanted to give this plugin a try, however I couldn't find instructions for installing this plugin or migrating from rainlab/translate.

This is what I did, which appears to have worked to at least get the page to render, however, I am unsure if the messages were migrated. I would assume not:

php artisan plugin:remove rainlab.translate
composer require winter/wn-translate-plugin
php artisan winter:up

Unfortunately, there are other plugins I am using that depend on rainlab/translate, so I wouldn't be able to use this one anyway unless the plugin's $require property can somehow have multiple choices, like $require = ['RainLab.Translate|Winter.Translate'];, can it?

multiwebinc
multiwebinc

What version of RainLab's translate plugin was installed before you tried installing Winter's translate plugin?

Pretty sure it was v1.8.7.

Dec
8
1 month ago
Activity icon
issue

multiwebinc issue comment wintercms/wn-translate-plugin

multiwebinc
multiwebinc

Scanner does not match plurals, and other filters

Checking the source, the processStandardTags() method seems to do a few regex matches to find translatable strings, however, it doesn't match for these filters:

__ (double underscore) transRaw transRawPlural localeUrl

I haven't tested it extensively, however this regex appears to work for me (I have about 400 strings):

{{\s*(["'])((?:(?:(?!\1)).)+)\1\s*[|]\s*(?:_{1,2}|transRaw(?:Plural)?|localeUrl)\s*(?:\([^\)]+\)\s*)?}}

Here's the PHP:

    protected function processStandardTags($content)
    {
        preg_match_all('#{{\s*(["\'])((?:(?:(?!\1)).)+)\1\s*[|]\s*(?:_{1,2}|transRaw(?:Plural)?|localeUrl)\s*(?:\([^\)]+\)\s*)?}}#', $content, $match);
        return $match[2] ?? [];
    }
multiwebinc
multiwebinc

On a side note, that should probably be $matches, not $match, since it's an array.

Also, this is great and all, but I was wondering if there was a way to actually use Twig's built-in functions to do this instead?

Activity icon
issue

multiwebinc issue wintercms/wn-translate-plugin

multiwebinc
multiwebinc

Scanner does not match plurals, and other filters

Checking the source, the processStandardTags() method seems to do a few regex matches to find translatable strings, however, it doesn't match for these filters:

__ (double underscore) transRaw transRawPlural localeUrl

I haven't tested it extensively, however this regex appears to work for me:

{{\s*(["'])((?:(?:(?!\1)).)+)\1\s*[|]\s*(?:_{1,2}|transRaw(?:Plural)?|localeUrl)\s*(?:\([^\)]+\)\s*)?}}

Here's the PHP:

    protected function processStandardTags($content)
    {
        preg_match_all('#{{\s*(["\'])((?:(?:(?!\1)).)+)\1\s*[|]\s*(?:_{1,2}|transRaw(?:Plural)?|localeUrl)\s*(?:\([^\)]+\)\s*)?}}#', $content, $match);
        return $match[2] ?? [];
    }
pull request

multiwebinc pull request wintercms/wn-translate-plugin

multiwebinc
multiwebinc

Make sure tables don't exist before creating them in migrations

See #13

Activity icon
fork

multiwebinc forked wintercms/wn-translate-plugin

⚡ Translate plugin for Winter CMS
multiwebinc MIT License Updated
fork time in 1 month ago
Activity icon
issue

multiwebinc issue comment wintercms/wn-translate-plugin

multiwebinc
multiwebinc

Need installation/migration instructions

I was previously using rainlab/translate (I believe v1.8.7), but I wanted to give this plugin a try, however I couldn't find instructions for installing this plugin or migrating from rainlab/translate.

This is what I did, which appears to have worked to at least get the page to render, however, I am unsure if the messages were migrated. I would assume not:

php artisan plugin:remove rainlab.translate
composer require winter/wn-translate-plugin
php artisan winter:up

Unfortunately, there are other plugins I am using that depend on rainlab/translate, so I wouldn't be able to use this one anyway unless the plugin's $require property can somehow have multiple choices, like $require = ['RainLab.Translate|Winter.Translate'];, can it?

multiwebinc
multiwebinc

Thanks for the quick replies, guys. If I simply do composer require winter/wn-translate-plugin, it keeps using RainLab. If I then delete the plugins/rainlab/translate directory, I get an error saying something along the lines of the _ filter not existing. I then re-executed the above composer command and then did php artisan winter:up, and I get errors in the migration:

Winter.Translate

In Connection.php line 669:
                                                                                                                                                                                                                                         
  SQLSTATE[HY000]: General error: 1 table "rainlab_translate_messages" already exists (SQL: create table "rainlab_translate_messages" ("id" integer not null primary key autoincrement, "code" varchar null, "message_data" text null))  
                                                                                                                                                                                                                                         

In Exception.php line 18:
                                                                                       
  SQLSTATE[HY000]: General error: 1 table "rainlab_translate_messages" already exists  
                                                                                       

In PDOConnection.php line 82:
                                                                                       
  SQLSTATE[HY000]: General error: 1 table "rainlab_translate_messages" already exists

Then going to the page, I get:

SQLSTATE[HY000]: General error: 1 no such table: winter_translate_locales (SQL: select "name", "code" from "winter_translate_locales" where "is_enabled" is not null and "is_enabled" = 1 order by "sort_order" asc)

I had to update several of the migration files to do checks to create the tables only if they don't exist already. I'll make a PR to address this.

Dec
7
1 month ago
Activity icon
issue

multiwebinc issue wintercms/wn-translate-plugin

multiwebinc
multiwebinc

Need installation/migration instructions

I was previously using rainlab/translate (I believe v1.8.7), but I wanted to give this plugin a try, however I couldn't find instructions for installing this plugin or migrating from rainlab/translate.

This is what I did, which appears to have worked to at least get the page to render, however, I am unsure if the messages were migrated. I would assume not:

php artisan plugin:remove rainlab.translate
composer require winter/wn-translate-plugin
php artisan winter:up

Unfortunately, there are other plugins I am using that depend on rainlab/translate, so I wouldn't be able to use this one anyway unless the plugin's $require property can somehow have multiple choices, like $require = ['RainLab.Translate|Winter.Translate'];, can it?

Dec
6
1 month ago
Activity icon
issue

multiwebinc issue vdlp/oc-redirect-plugin

multiwebinc
multiwebinc

Feature request: Regular expression matches in target path

I was just wondering if you could add a way to add the matches for the regular expressions to the target path, like for replacing part of the URL with something else:

For example, if I want to redirect all requests to /foo/* to /bar/* where * is a wildcard that matches anything. I have the following regex:

@/foo/(.*)[email protected]

It would nice if you could set the target path to something like:

/bar/{1}

where {1} corresponds $matches[1] from preg_match().

Dec
2
1 month ago
Activity icon
issue

multiwebinc issue comment Ubuntu-Cinnamon-Remix/yaru-cinnamon

multiwebinc
multiwebinc

Error with yaru-cinnamon-theme-icon when doing dist-upgrade on fresh install

Fresh install of Ubuntu Cinnamon Remix. First thing I did was upgrade the packages and it errors out with the following package:

# apt dist-upgrade -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  yaru-cinnamon-theme-icon
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/27,1 MB of archives.
After this operation, 16,8 MB of additional disk space will be used.
(Reading database ... 321705 files and directories currently installed.)
Preparing to unpack .../yaru-cinnamon-theme-icon_21.10.1_all.deb ...
Unpacking yaru-cinnamon-theme-icon (21.10.1) over (21.04.3) ...
dpkg: error processing archive /var/cache/apt/archives/yaru-cinnamon-theme-icon_21.10.1_all.deb (--unpack):
 unable to open '/usr/share/icons/Yaru-Cinnamon/16x16/categories/applications-multimedia.png.dpkg-new': No such file or directory
No apport report written because the error message indicates an issue on the local system
                                                                                         Errors were encountered while processing:
 /var/cache/apt/archives/yaru-cinnamon-theme-icon_21.10.1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
multiwebinc
multiwebinc

@hsbasu That's likely what I did, however this bug report is not about how the user can fix the error; it's about the Ubuntu Cinnamon Remix team updating their packages so that upgrades work correctly.

Nov
30
1 month ago
Activity icon
issue

multiwebinc issue strapi/strapi

multiwebinc
multiwebinc

Strapi installs multiple versions of graphql

Here is my package.json

{
  "name": "strapi-sqlite",
  "private": true,
  "version": "0.1.0",
  "description": "A Strapi application",
  "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi"
  },
  "dependencies": {
    "knex": "0.21.18",
    "sqlite3": "^5.0.2",
    "strapi": "3.6.8",
    "strapi-admin": "3.6.8",
    "strapi-connector-bookshelf": "3.6.8",
    "strapi-plugin-content-manager": "3.6.8",
    "strapi-plugin-content-type-builder": "3.6.8",
    "strapi-plugin-email": "3.6.8",
    "strapi-plugin-graphql": "3.6.8",
    "strapi-plugin-upload": "3.6.8",
    "strapi-plugin-users-permissions": "3.6.8",
    "strapi-utils": "3.6.8"
  },
  "author": {
    "name": "A Strapi developer"
  },
  "strapi": {
    "uuid": "e9d9b989-d145-4ed3-80e4-dd009b4cfc7e"
  },
  "engines": {
    "node": ">=10.16.0 <=14.x.x",
    "npm": "^6.0.0"
  },
  "license": "MIT"
}

When trying to start strapi, I get the following output:

npm run develop    

> [email protected] develop
> strapi develop

[2021-11-30T15:55:32.463Z] debug ⛔️ Server wasn't able to start properly.
[2021-11-30T15:55:32.465Z] error Error: Cannot use GraphQLObjectType "Query" from another module or realm.

Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.

https://yarnpkg.com/en/docs/selective-version-resolutions

Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.
    at instanceOf (/home/mike/Seafile/www/ibgs/strapi-sqlite/node_modules/strapi-plugin-graphql/node_modules/graphql/jsutils/instanceOf.js:29:13)
    at isObjectType (/home/mike/Seafile/www/ibgs/strapi-sqlite/node_modules/strapi-plugin-graphql/node_modules/graphql/type/definition.js:122:34)
    at printType (/home/mike/Seafile/www/ibgs/strapi-sqlite/node_modules/strapi-plugin-graphql/node_modules/graphql/utilities/printSchema.js:130:36)
    at /home/mike/Seafile/www/ibgs/strapi-sqlite/node_modules/strapi-plugin-graphql/node_modules/graphql/utilities/printSchema.js:59:12
    at Array.map (<anonymous>)
    at printFilteredSchema (/home/mike/Seafile/www/ibgs/strapi-sqlite/node_modules/strapi-plugin-graphql/node_modules/graphql/utilities/printSchema.js:58:13)
    at Object.printSchema (/home/mike/Seafile/www/ibgs/strapi-sqlite/node_modules/strapi-plugin-graphql/node_modules/graphql/utilities/printSchema.js:40:10)
    at writeGenerateSchema (/home/mike/Seafile/www/ibgs/strapi-sqlite/node_modules/strapi-plugin-graphql/services/schema-generator.js:138:31)
    at Object.generateSchema (/home/mike/Seafile/www/ibgs/strapi-sqlite/node_modules/strapi-plugin-graphql/services/schema-generator.js:109:5)
    at Object.initialize (/home/mike/Seafile/www/ibgs/strapi-sqlite/node_modules/strapi-plugin-graphql/hooks/graphql/index.js:76:74)
    at /home/mike/Seafile/www/ibgs/strapi-sqlite/node_modules/strapi/lib/hooks/index.js:37:28

I also tried adding a "resolutions" field as well:

"resolutions": {
  "graphql": "^15.5.0",
  "**/graphql": "^15.5.0"
}

However, that didn't appear to have any effect.

I also tried running strapi build "--clean", but that also didn't fix it either.

Nov
19
2 months ago
Activity icon
fork

multiwebinc forked thephpleague/html-to-markdown

⚡ Convert HTML to Markdown with PHP
multiwebinc MIT License Updated
fork time in 2 months ago
Activity icon
issue

multiwebinc issue comment thephpleague/html-to-markdown

multiwebinc
multiwebinc

Horizontal rules use non-standard format

Version(s) affected

5.0.2

Description

According to https://www.markdownguide.org/basic-syntax/#horizontal-rules

To create a horizontal rule, use three or more asterisks (***), dashes (---), or underscores (___) on a line by themselves.

This library, instead, uses - - - - - -, which would appear to be non-standard from everywhere I could find.

This causes an issue (for example) with https://github.com/erusev/parsedown when you have an unordered list followed by a horizontal rule. When parsed as HTML, the <hr> is appended to an additional <li> inside the list instead of being after the list.

How to reproduce

<hr>

multiwebinc
multiwebinc

Thanks @colinodell. I wasn't aware of that spec. I've therefore reported a bug in the Parsedown repo erusev/parsedown#818. Unfortunately, the code for the parser there hasn't been updated for 3 years now, so who knows...

Activity icon
issue

multiwebinc issue erusev/parsedown

multiwebinc
multiwebinc

Unordered list followed by horizontal rule produces incorrect HTML

According to https://spec.commonmark.org/0.30/#thematic-breaks, for thematic breaks,

[s]paces and tabs are allowed between the characters:

Therefore, we can use - - - (with spaces in between), which should produce a <hr /> tag in the HTML.

This works in parsedown, except when the hr is after a ul:

- List item

- - -

This incorrectly produces the HTML:

<ul>
<li>
<p>List item</p>
</li>
<li>
<ul>
<li>-</li>
</ul>
</li>
</ul>

Expected output:

<ul>
<li>List item</li>
</ul>

<hr />
Activity icon
issue

multiwebinc issue thephpleague/html-to-markdown

multiwebinc
multiwebinc

Horizontal rules use non-standard format

Version(s) affected

5.0.2

Description

According to https://www.markdownguide.org/basic-syntax/#horizontal-rules

To create a horizontal rule, use three or more asterisks (***), dashes (---), or underscores (___) on a line by themselves.

This library, instead, uses - - - - - -, which would appear to be non-standard from everywhere I could find.

This causes an issue (for example) with https://github.com/erusev/parsedown when you have an unordered list followed by a horizontal rule. When parsed as HTML, the <hr> is appended to an additional <li> inside the list instead of being after the list.

How to reproduce

<hr>

Nov
18
2 months ago
Activity icon
issue

multiwebinc issue thephpleague/html-to-markdown

multiwebinc
multiwebinc

Line breaks inside tag

Version(s) affected

5.0.2

Description

Line breaks inside tags produce incorrect markdown

How to reproduce

HTML:

<b>Hello<br><br>World</b>

Output:

**Hello  
  
world**

Expected output:

**Hello**
  
**world**