Giter Club home page Giter Club logo

lingua's People

Contributors

goldsky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

lingua's Issues

lingua.getValue Snippet doesn't default properly

When using the lingua.getValue snippet, data is not pulled from the default language. This bug affects not only instances when the selected translation isn't available, but instances where the default language is the one selected; in either case, lingua.getValue will return nothing.

This snippet should always return the value for the default language (i.e., the value from modx_site_content) if the translated value doesn't exist (i.e., the value from modx_lingua_site_content).

To get around this problem, I had to write the following wrapper snippet that I call instead of lingua.getValue:

// initialize
$vars = array(
    'id'=>$id,
    'field'=>$field
);

// get translated field
$field = $modx->runSnippet('lingua.getValue', $vars);

// if no translation, then get default
if (empty($field)) {
    $field = $modx->runSnippet('getResourceField', $vars);
}

richtext-editor shows up for content, when resource-setting richtext is off

when setting richtext to off for a resource, it does work on first load (textarea for all languages).
After saving the resource,
richtext-editor shows up for other languages, than the first language.
First language is textarea like it should, but other languages (did only try with one additional language) have richtext-editor instaed of textarea.

Lingua breaks Weblink resources

Like the title says. Regardless of whether you are using a page ID or a full URL, Weblink resources do not work when Lingua is installed.

Not displaying field values in manager when MODX installed in sub-directory

If MODX is installed in web root everything works fine.

However, if MODX is installed in a sub directory, when switching from the default language to another on a resource in the manager all the fields are blank.

I seem to be able to save and everything works on the web context if the fix is applied from the previous issue, but when you come back to the secondary language in the manager all the fields are blank. It seems to have trouble loading the values even though they are apparently saved.

I haven't tested TVs yet.

TV value does not switch with getResources

Hello @goldsky!
I found a little bug but very annoying. I had a problem with lingua.getValue snippet. It works great on it's own and get all TV's values well. But if used with getResources from inside a tpl Chunk it does not get (or output) the right value of Template Variables and uses the default value. And I have to notice that I took care of these two getResources options: &includeTVs=1, &processTVs=1

And now my example:
This the line wich should display the right link to an image according to the language key:
<img src="[[lingua.getValue:default=[[+art.image]]? &id=[[+id]]&field=art.image]]" />

But it doesn't work inside getResources. All standard fields language is switching right - content, pagetitle, etc.
Whats interesting from within this template:
<img src="[[lingua.getValue:default=[[_art.image]]? &id=[[_id]]&field=art.image]]" />
it works great.

So I decided to look inside the snippet code, although I'm rather a poor backend developer :) And I did some experiments with lingua.getValue:

Original code:

// try TV
else {
    $tv = $modx->getObject('modTemplateVar', array(
        'name' => $field,
    ));
    if ($tv) {
        $linguaSiteTmplvarContentvalues = $modx->getObject('linguaSiteTmplvarContentvalues', array(
            'lang_id' => $langObj->get('id'),
            'tmplvarid' => $tv->get('id'),
            'contentid' => $id,
        ));
        if ($linguaSiteTmplvarContentvalues) {
            $value = $linguaSiteTmplvarContentvalues->get('value');
            $tv->setValue($tv->get('id'), $value);
        }
        $output = $tv->renderOutput($resource->get('id'));
    }
}

And the code after makeovers:

// try TV
else {
    $tv = $modx->getObject('modTemplateVar', array(
        'name' => $field,
    ));
    if ($tv) {
        $linguaSiteTmplvarContentvalues = $modx->getObject('linguaSiteTmplvarContentvalues', array(
            'lang_id' => $langObj->get('id'),
            'tmplvarid' => $tv->get('id'),
            'contentid' => $id,
        ));
        if ($linguaSiteTmplvarContentvalues) {
            $value = $linguaSiteTmplvarContentvalues->get('value');
            // $tv->setValue($tv->get('id'), $value);
        }
        // $output = $tv->renderOutput($resource->get('id'));
        $output = $value;
    }
}

I've just commented out two lines and instead of rendering the TV just outputing the found right value. And it started to work poroprerly. I'm not an expert so I hope you will improve the code. Meanwhile you can use this solution if anybody copes with the same problem.

Greetings

incompatibility with Articles add-on

MODx 2.3.1, Articles extra installed, which is quite widespread for building blogs / news sections etc. No dropdown appears neither when editing articles container nor when editing an article item.

MODx features like TV etc are compatible with this plugin, so it's likely adding a small piece of code making Lingua plugin compatilbe with this.

It'll be appreciated a lot.

lingua dont work with migx

hi, i have a migx (this migx work only in web context) but dont show in backend a table grid, for other language, please help me

Problem with default language settings

When the default language in the Modx-System-Settings are changed ("cultureKey", "fe_editor_lang"), the Lingua-translations in resources are messed up.
Probably the the content of the previous default language becomes the content of the new default language...

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/3471253-problem-with-default-language-settings?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github).

lingua.selector causing manager to log out

Testing out Lingua for the first time.
Placed the selector snippet on the home resource to test.
Works fine until I go back to the manager which presents me with the login screen as soon as I try to load another manager page.
It only happens when I click on the language link in the selector drop down on the web context.
Modx 2.3.3

Any ideas what could be causing this?

Edit: I've tried deleting the cache and removing all cookies.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/9737839-lingua-selector-causing-manager-to-log-out?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github).

Lingua doesn't work with getResources and setPlaceholders

I use setPlaceholders package to get all the TVs from a common resources that shows up in header and footer. Same as the navigations using getResources. Whenever i change the language, those TVs displayed by getResources and setPlaceholders (TVs with [[+TVName]]) won't change to the selected language.

Would this plugin support the functionality a speak above?

Response will be greatly appreciated.

Thank you :)

Need batch update for imported resources

After the initial import with ImportX the resources exist in the modx_site_content and in template variables tables because the default language values were included in the import.

At this point i'd like to update just the translated values in lingua tables but the newly imported resources don't exist there yet. They are only copied after a resource is edited in the manager and saved. I'm wondering if there's a way to make lingua pickup the newly imported resources in batch and insert them into its tables. At which point a simple sql update to add translated values into lingua tables can be done.

Form Customization: Standard fields are ignored

I have set up some Form Customization rules which include hiding / renaming some of the standard fields (description, introtext, link-attributes). Everything is fine on my standard language but when I switch to another language, all of the standard fields appear AND my custom renaming is gone.
One mor thing: when I rename a standard field, the flag is gone.

lingua_form_customization_issue

Applying Localization

http://www.w3.org/International/questions/qa-i18n.en

  1. Numeric, date and time formats
  2. Use of currency

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/5305720-applying-localization?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github).

detect browser language doesn't work

Hi, ii set lingua.detect_browser system setting to Yes and made a try with few computers. Every time default language is loaded. How can I check what's wrong?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/4883604-detect-browser-language-doesn-t-work?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github).

speed / page load time increases by using getValue

I have massive speed problems on my site when using the lingua.getValue snippet inside a pdoResources call, which is placed inside another pdoResources call.

As soon as I use something like this:

[[!lingua.getValue? &id=[[+id]]&field=myTvName]]
[[!lingua.getValue? &id=[[+id]]&field=pagetitle]]

my page loading time increases up to 13 seconds in average. When I delete the lingua.getValue snippet call from my pdoResources call, my page loading time is about 2.5 seconds.

Is there any faster way to get translated resources fields or TV's?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/30318147-speed-page-load-time-increases-by-using-getvalue?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github).

Modx 2.3: Update of language settings in CMP not possible

With Modx 2.3 on the CMP of Lingua the language settings (Locale name, flag, language code...) for a specific language is not possible. The Update-Window appears, but changed values are not saved. The following error is in the log:

[2014-07-19 11:58:00] (ERROR @ /assets/components/lingua/conn/mgr.php) Processor /var/www/chso-com/htdocs/www/core/components/lingua/processors/mgr/lang/update.php does not exist; Array
(
    [processors_path] => /var/www/chso-com/htdocs/www/core/components/lingua/processors/
    [location] => 
    [action] => mgr/lang/update
)

lingua + getresources

Hi,

I got lingua working fine and i really like this approach of a lingual site.
But i have a problem when using getresources.
When i output the pagetitle in getresource's tpl, for example: [[+pagetitle]] it doesnt show the current language pagetitle.

Or maybe i'm just doing something wrong?

Thanks

Customize / Override Link Tags

When using Lingua, link tags (e.g. [[~4]]) should be language-specific. As it is, the link tags always return the default link (i.e., the non-lingua uri data).

In the meantime, I had to create a custom snippet to use instead of the link tag... but that can get pretty unwieldy...

Empty select-field for new Resource

When creating a new Resource, the lingua-select-field for the language is empty. No language is chosen. (Modx 2.3)
image

Which language would the content be assigned, when no language is chosen? And how can this default language been set for a new Resource?

Translatable Chunks?

It would be great if you could add support for translatable chunks. Here's what I envision:

When you edit a chunk, you get the language dropdown just like when editing a resource. Chunks can then be referenced normally (as a single chunk), but it pulls the correct language version for that chunk.

There's a lot of static site-level (as opposed to page-level, e.g., TVs) content that needs to be translatable, too.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/6883125-translatable-chunks?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github).

Can't save empty translated TV fields

(This kind of goes along with this issue which deals with delivering fields from the default language if translated fields aren't available.)

If using translatable TV fields, once you enter data there is no way to clear it out. In other words, empty TV fields will not save to the DB. One should be able to clear out TV fields without having to manually go into the database.

Feature request

Is it possible to automatically detect browser language with Lingua?

Redactor support? [$15]

We've had an issue reported by @sottwell about Lingua creating multiple instances of the Redactor content editor when languages are switched.

We were able to reproduce the issue in her dev cloud and noticed that it only seems to happen for German (two editors) and Italian (three editors).

--- There is a **[$15 open bounty](https://www.bountysource.com/issues/27178072-redactor-support?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github)** on this issue. Add to the bounty at [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github).

lingua.selector

Hello. Moved the site to a server version of PHP 5.4, get on the main page error when switching languages. On other pages all is well.
kazam_screenshot_00074
This is due to double-slash (address line). If the snippet to replace this line
on
$pageURL = $parseUrl['scheme'] . '://' . $parseUrl['host']. $parseUrl['path'];
error disappears.
By the way, on my server php 5.5, this error was not.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/31870175-lingua-selector?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github).

Need a Published checkbox / setting for Languages

Currently there are 2 states that a language can be in: Active or Inactive. Practically speaking, there should be 3 states: Inactive, Active, and Published.

  • Inactive: Language doesn't show up anywhere
  • Active: Language appears in manager for editing, but on the front end it is not available in the language selection. Lingua also will not select it during browser language detection. However, you can still view the language on the front end by manually setting the GET variable (or perhaps through some other method) ...in order to preview content while editing.
  • Published: Language fully appears in all locations

Translation and/or loading up of translations is not an instantaneous process. There should be a mechanism by which material can be worked on without it showing up on the front end incomplete.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/6890845-need-a-published-checkbox-setting-for-languages?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github).

TV saving problem: second language should have empty value

I can not save TV's where the second language has an empty value. After saving and refreshing (Backend) I always get the value of my main language in my second language. Happens with imageTV's, MIGX TV's,...

Example: Main language is German, second language is English.

imageTV (DE selected): imagename-DE.jpg
imageTV (EN selected): imagename-EN.jpg

When I delete the file from the second language:

imageTV (DE selected): imagename-DE.jpg
imageTV (EN selected):

hit save and refresh the page, i get this:

imageTV (DE selected): imagename-DE.jpg
imageTV (EN selected): imagename-DE.jpg

Problem with MIGx

When I add a TV of type MIGx lingua duplicate the field the same

When you add a TV-type MIGx, to lingua. The manager page show me 3 times in the TV in all languages(instead of 1 field in every language), and even when the information is filled in the 3 fields(duplicated), in the frontend does not see any value.

Here an image showing the problem:

problem

I hope this can be solved.
Thanks in advance.

Static resources should work with Lingua

When switching a resource to "Static Resource", the content area is converted to a "Static Resource" file entry field. This field should be "translatable" in Lingua, i.e., one should be able to point the front end to different files (say, localized PDFs) based on language selection.

MODX saves the path to the source file in the content area of the site_content table, so it seems like it wouldn't be too hard to have Lingua do the same thing that it does with "Document" resources. In fact, you can get it mostly working now by doing the following:

  1. Add all the localized content (titles, alias, etc.) and then put the correct file paths into all the content areas for each translation while in "Document" mode and save.
  2. Switch the resource type to "Static Resource" and save (you'll be saving with the content areas still visible)
  3. DO NOT SAVE AGAIN... if you save the page while it's already in "Static Resource" mode, i.e., the Content field has been replaced with Static Resource in the editor, then Lingua will clear out all of its content fields for that resource and it will stop delivering the translated versions of the files.

THE CAVEAT: Even though doing the above will cause MODX to output the correct source file, the file name will always be from the default language URI, so you still can't get a localized file-name for your static resource.

lingua_selector

I got Lingua working - it is great. However I have two questions/issues:
#1: I'm using it for two languages (English and German) and the lingua_selector displays sometimes "Select language" and sometimes "lingua.select_language"
#2: The language selector does something weird with pages which do not have an .html at the end

For issue #1: http://nde-consulting.com/dr.-johannes-vrana.html
For issue #2 (and #1): http://nde-consulting.com/

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Different Language Settings per Context / Parent / Resource

As someone building out a multi-site MODX install using a single manager with different contexts, it occurs to me that language activation needs to happen at the context level and not the global level. Some sites may have different sets of translations than others, and some may not have any at all.

To piggyback onto this feature request, the CMP for Lingua should probably be rewritten a bit. The current "Settings" tab should remain mostly unchanged except to rename the tab "Languages" and remove the "Active" setting. Then add a new tab: "Contexts" where you can assign languages to contexts and mark them as active or inactive.

If a language is assigned to a context, it can be selected in the editor for that context's resources. If it is marked as active then that translation will also be selectable on the front-end.

This would, of course, replace the lingua.contexts system setting.

If you want to get really fancy and replace the lingua.ids and lingua.parents settings, you could add two more tabs: "Resources" and "Parents" that allow you to assign languages to each respectively. I imagine, though, that that could get mighty tricky. Maybe on the "Contexts" tab, have a place where you can enter resource/parent IDs on the context to indicate specific resources that the settings (at the context level) should apply to. Kind of a hybrid of the current system and the new.

Compatibility with Auto-Tag TV Fields

This Extra is already flipping amazing—and this would just be a nice-to-have, icing-on-the-cake feature—but I figured I would throw it up here anyway!

The built-in Auto-Tag TV type generates clickable tags based on all the entries of the template variable. The field itself translates just fine, but it would be extra-sweet if the clickable tags would also build out and be usable per-language (right now they only work for the default language).


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Language Switching Bug w/ Rich Text Settings

I just ran across this bug that had me stumped—took me forever to even figure out what was causing the issue. I'm still not 100% sure that this isn't just something quirky with my build, but the fix won't break anything even if that's the case.

Behavior:
When a resource is set to Rich Text but you don't have a rich text editor installed, switching between languages gets really wonky. Some language content fields don't show up at all, and others are sized improperly.

Problem:
In the resource.js file if a resource is set as rich text, the js tests to see if MODx.ux.CKEditor is defined. However, MODx.ux is itself undefined—and since you can't test a property of "undefined", js kicks back an error causing the content field switching to fail in odd ways.

Solution:
Test MODx.ux before testing MODx.ux.CKEditor. In the resource.js file, replace lines 229–231 with the following:

if (typeof(MODx.ux) !== 'undefined') {
    if (typeof(MODx.ux.CKEditor) !== 'undefined') {
        MODx.ux.CKEditor.replaceComponent(this.getId());
    }
}

AjaxManager compatibility issues

  1. Ext.onReady should not be placed in static js files.
  2. Lingua = new Lingua() overrides it's constructor. Use lowercased first letter for instance name (conventional naming).
  3. Issue: (ajax)reload page, select another language -> all fields with flags get hidden. Its ok after switching between tabs. Need some research why this happens. May be you know.

Alias generation buggy and [[~ID]] not translated

Hi there

Firstly: Lingua ist awesome. :)
Second: We have some problems with alias path generation in frontend. In a test installation it didn't generate the alias for a resource in one language. And we weren't able to change it afterwards.

But a subsite of the said resource then had the correct alias path. And we could change it.

On a second note, it doesn't seem like lingua translates alias path when generating a url with [[~link]]. Is there a way to provide that?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Tinymce-RTE not working with Lingua

Works fine on the default language but won't save the content field for the second language.

It says it saves and doesn't put any errors in the MODX log or in firebug.
But if I refresh the page the content for the second language isn't showing anymore so it's not getting stored.

The work-around is to disable rich text for the resource, input the content and save it, then enable rich text again.

Any ideas?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/27915268-tinymce-rte-not-working-with-lingua?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github).

Different active languages per context

When using contexts for different/separate websites its important that each individual site can have its own set of active languages. Sometimes not all sites share the same set of languages.

Language sorting

Sorting languages order would be a good feature.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/4165563-language-sorting?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1919378&utm_medium=issues&utm_source=github).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.