GithubHelp home page GithubHelp logo

tap-i18n-db's People

Contributors

istoramandiri avatar rijk avatar theosp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar

tap-i18n-db's Issues

sort in client doesn't work properly

hey

it seems sorting doesn't work properly in minimongo queries
specifically, I have hebrew ('he') translations, but the sorting is done by the original values (en)

is this a known issue or maybe there's a fix/workaround?

thanks

Sort on i18n.fa field

Hello all,

I have an issue with sorting on i18n.fa field.
here is my collection format
name:"a" "i18n" : { "fa" : { "name" : "fs" } }, name:"c" "i18n" : { "fa" : { "name" : "fa" } }, name:"b" "i18n" : { "fa" : { "name" : "fc" } }

now in my code i used this publication code
TAPi18n.publish("name", function () { return Names.i18nFind({}),{sort:{name:1}}); });
and in client side i use this subscriptions
TAPi18n.subscribe('name', function() { return Names.i18nFind({}); });

now when i run application it gives alphabetical order "a,b,c" in english language. But when i switch language to "fa" it does not gives order "like fa,fa,fs" instead it gives "fs,fc,fa". Does anyone have solution for this why its not working?
Thanks

i18nFind() does not work in publication

I define collection Persons:

Persons = new TAPi18n.Collection("persons");

I have publication on the server:

TAPi18n.publish("persons", function () {
  return Persons.i18nFind();
});

And subscription on the client:

TAPi18n.subscribe('persons', function(err) {
  console.log('subscr persons: ', err);
});

If I use i18nFind() in publish, I get following error:

screenshot from 2014-12-10 23 10 56

If I use find(), there is no error but translation does not work after changing language.

Tested with Meteor 1.0.1 and 0.9.4

Here is example app: https://github.com/Elfoslav/tap-i18n-example

TAPi18n.publish / subscribe never ready in Iron Router 1.0.0

Since the update to Meteor 1.0.0, one of my routes that depends on the @ready() state doesn't work anymore. This seems to be a problem with TAPi18n, because if I change my publish/subscribe methods back to Meteor.publish the problem goes away.

Route:

@route '/home',
    path: '/home'
    subscriptions: -> TAPi18n.subscribe 'courses'
    action: -> console.log 'home', @ready() # never true

Publication (fake):

TAPi18n.publish 'courses', ->
    @ready()

This never prints true to the console. However, this does:

Route:

@route '/home',
    path: '/home'
    subscriptions: -> Meteor.subscribe 'courses'
    action: -> console.log 'home', @ready()

Publication:

Meteor.publish 'courses', ->
    @ready()

insert failed: TAPi18n is not supported

After installing the package and trying to translate a field in the collection, I got this error (both on the server and client):

insert failed: TAPi18n is not supported

Future of tap-i18n-db?

Hey everyone, so this awesome package has been unmaintained for a few years. What are the future plans does someone know?

Thanks,
Kris

Working with SubscriptionManager.

I'm using SubscriotionManager.

The issue is that I don't know how to work this subscription with i18n-db.

This is the settings I'm currently working on.

Subs = new SubsManager({
// maximum number of cache subscriptions
cacheLimit: 10,
// any subscription will be expire after 5 minute, if it's not subscribed again
expireIn: 5
});

Subs.subscribe('allUserData'),
Subs.subscribe('groups'),

How do I extend on top of this?
TAPi18n.subscribe("inventors", 1800);

Collection.i18nFind query with translated field

I'm trying to fetch some records using i18nFind using translated field in a query, like so:

TAPi18n.publish('News.byTitle', function(title) {
    check(title, String);
    return News.i18nFind({ title: title });
})

That doesn't work when I choose non-English language in a client. I know there's matched record in database and can fetch it using News.find({ 'i18n.ru.title': title }).

Does i18nFind support this anyway? Maybe I'm just doing something wrong?

fastrender support

I trying to add fastrender to my app.

i becoming the following error:

W20150919-10:28:28.581(2)? (STDERR) error on fast-rendering path: / ; error: TypeError: Object [object Object] has no method 'subscribe'
W20150919-10:28:28.582(2)? (STDERR)     at [object Object].FlowRouter.route.subscriptions (app/routes/home.js:3:42)
W20150919-10:28:28.582(2)? (STDERR)     at Context.<anonymous> (packages/kadira:flow-router/server/plugins/fast_render.js:30:1)
W20150919-10:28:28.582(2)? (STDERR)     at packages/meteorhacks:fast-render/lib/server/routes.js:72:1
W20150919-10:28:28.582(2)? (STDERR)     at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
W20150919-10:28:28.582(2)? (STDERR)     at Object._processRoutes (packages/meteorhacks:fast-render/lib/server/routes.js:71:1)
W20150919-10:28:28.582(2)? (STDERR)     at FastRender.handleRoute (packages/meteorhacks:fast-render/lib/server/routes.js:48:1)
W20150919-10:28:28.582(2)? (STDERR)     at doCall (packages/meteorhacks:picker/lib/implementation.js:98:1)
W20150919-10:28:28.583(2)? (STDERR)     at [object Object].PickerImp._processRoute (packages/meteorhacks:picker/lib/implementation.js:92:1)
W20150919-10:28:28.583(2)? (STDERR)     at processNextRoute (packages/meteorhacks:picker/lib/implementation.js:60:1)
W20150919-10:28:28.583(2)? (STDERR)     at processNextRoute (packages/meteorhacks:picker/lib/implementation.js:62:1)

how can i fix this?

thanks for help

Support for i18nFind in Meteor methods

When I try to use i18nFind in Meteor method, I get exception "TAPi18n.i18nFind should be called only from TAPi18n.publish functions". Why this restriction? How Can I get translated document inside Meteor method? Also i18nFindOne would be nice.

i18nFind breaking in 1.2?

After upgrading to 1.2 we are getting the null or undefined error. Changing to find works.
Is there an issue with seeing the project-tap.i18n file or a router issue?

20150922-14:48:32.070(2)? Exception from sub applications id NbWxw3dTZANwGWXnP TypeError: Array.prototype.indexOf called on null or undefined
20150922-14:48:32.070(2)? at [object Object].obj.i18nFind (packages/tap_i18n-db/packages/tap_i18n-db.js:352:1)
20150922-14:48:32.070(2)? at indexOf (native)
20150922-14:48:32.071(2)? at [object Object].i18n_handler as _handler
20150922-14:48:32.072(2)? at [object Object]..extend.startSubscription (livedata_server.js:842:9)
20150922-14:48:32.072(2)? at [object Object].
.extend.protocol_handlers.sub (livedata_server.js:614:12)
20150922-14:48:32.071(2)? at [object Object].
.extend._runHandler (livedata_server.js:1023:17)
20150922-14:48:32.072(2)? at livedata_server.js:548:43
20150922-14:48:32.071(2)? at maybeAuditArgumentChecks (livedata_server.js:1692:12)
20150922-14:48:32.071(2)? at [object Object].Meteor.publish.query

Support removing specific translations

I have run into a scenario where the removeTranslation() and removeLanguage() functionality is not sufficient. In my collection I'm storing options to a multiple choice question:

{
    "_id" : "FMMepvz85Ne9CvE3L",
    "title" : "Multiple Choice",
    "correct" : 5,
    "options" : [ 
        {
            "text" : "option one",
            "value" : 2
        }, 
        {
            "text" : "option two",
            "value" : 5
        }, 
        {
            "text" : "option three",
            "value" : 3
        }
    ],
    "i18n" : {
        "nl" : {
            "options" : [ 
                {
                    "text" : "optie een",
                    "value" : 2
                }, 
                {
                    "text" : "optie twee",
                    "value" : 5
                }, 
                {
                    "text" : "optie drie",
                    "value" : 3
                }
            ],
            "title" : "Meerkeuze"
        }
    }
}

This works perfectly. When removing an option though, it is very important that the translation is also removed. Otherwise, the interface may display deleted options, or incorrect translations based on the array key.

As the remove*() methods are using $unset, I am unable to apply the kind of matching required for this. I currently work around this with a manual $pull query, like this:

removeOption: ( value ) ->
    @constructor._collection.update { _id: @_id }, { '$pull': { 'i18n.nl.options': { value: value } } }

While this works, I have to hardcode the i18n field name. It would be preferable to do this through the package API. I'll think about possible ways to implement this in the API.

In addition, I would like to be able to simply invalidate all translations of this property, which I seem to not be able to do right now (every function requires a language argument). But I'll open a seperate issue for this.

Compatibility with packages that initiate collections with their own prefix?

Hello,

So TAP initiates collections with TAPi18n.Collection("something"); however some other packages like for example Orion / Scorpius, etc also want to initiate collections with their own prefix i.e. Scorpius.Collection("something"). Is there a way around this in javascript so such packages could be used together?

Thanks,
Kris

Invalidate all translations for a given key

As mentioned in issue #2, a pretty common use case is an object property changing which should invalidate existing translations. This is currently not possible through the API, as all methods for removing translations require a specific language argument.

Possible solutions:

  • allow a * argument instead of language identifier
  • add an invalidateTranslations() method, which has a similar signature to removeTranslations() but without the language parameter

How to use template-level subscriptions?

According to the docs, subscriptions have to be defined by using TAPi18n.subscribe(). But how does that match to template-level subscriptions, which have to be defined on the template via this.subscribe() in an onCreated() method?

PS: Is this repo still maintained? There are a lot of very old issues here without any replies.

Multiple Session Instances + Hot Code Push prevents language changing

During development I noticed that the language didn't change sometimes. It was due to having multiple instances of a open during hot code push.

To reproduce:

  1. Open two browser windows (same browser), set a language
  2. Update client code to cause hot code push / refresh
  3. Try changing language in both

Result: i18n-db does not update strings on setLanguage in one or both windows. i18n is fine; it's just i18n-db that's not updating.

Not a major concern right now, just keep it in mind during development!

tap-i18n-db and aldeed collection2

Hey Guys, has anyone ever tried using tap-i18n-db package with collections using the collection2 package? i tried a lot of stuff but couldn't get it working...would love to see some of your sample code! thanks and cheers!

Exception on i18nFind with meteorjs 1.2.0.1

Hi, I just update all meteor packages and got this error. Current tap-i18n-db package is 0.4.0 and meteorjs is 1.2.0.1. I reckon that similar issue has been fixed with meteorjs 1.2 but not sure if it is identical with this. Thanks!


I20150925-22:35:30.833(10)? Exception from sub book id 7EAiyoTETFPtsYxbk TypeError: Array.prototype.indexOf called on null or undefined
I20150925-22:35:30.833(10)?     at indexOf (native)
I20150925-22:35:30.833(10)?     at [object Object].obj.i18nFind (meteor://💻app/packages/tap_i18n-db/packages/tap_i18n-db.js:352:1)
I20150925-22:35:30.833(10)?     at [object Object]. (meteor://💻app/server/book.js:2:1)
I20150925-22:35:30.833(10)?     at [object Object].i18n_handler [as _handler](meteor://💻app/packages/tap_i18n-db/packages/tap_i18n-db.js:429:1)
I20150925-22:35:30.834(10)?     at maybeAuditArgumentChecks (meteor://💻app/livedata_server.js:1692:12)
I20150925-22:35:30.834(10)?     at [object Object]._.extend._runHandler (meteor://💻app/livedata_server.js:1023:17)
I20150925-22:35:30.834(10)?     at [object Object].subscriptionProto._runHandler (meteor://💻app/packages/meteorhacks_kadira/packages/meteorhacks_kadira.js:2604:1)

insert failed: TAPi18n is not supported

I put together a demo project the other day and things were working. Today, I decided to implement tap-i18n-db into my core project and when trying to seed the database with:

Interests.insertTranslations({slug: "ball-hockey", name: "Ball Hockey"});

I'm getting the error:

insert failed: TAPi18n is not supported

I have no idea what's causing this. I'm following the docs. Any ideas?

Existing collections and tap-i18n-db

Hello,

I have a Meteor application with some collections I want to translate now,
I've added both i18n and i18n-db plugins,
then I've made the following changes:

... (server)
PortfolioCategory = new TAPi18n.Collection('PortfolioCategory', {base_language : "en"});
...
TAPi18n.publish("PortfolioCategory", function() {
    return PortfolioCategory.i18nFind();
});
... (client)
TAPi18n.subscribe("PortfolioCategory");

instead of

... (server)
PortfolioCategory = new Meteor.Collection('PortfolioCategory');
...
Meteor.publish("PortfolioCategory", function() {
    return PortfolioCategory.find();
});
... (client)
Meteor.subscribe("PortfolioCategory");

In my application the collection seems to be empty afterwards

PortfolioCategory.find().fetch()
[]

Meteor console has a following error:

I20150730-21:29:37.024(2)? Exception from sub PortfolioCategory id dhisMMMEttj2c
qzSk TypeError: Array.prototype.indexOf called on null or undefined
I20150730-21:29:37.025(2)?     at [object Object].obj.i18nFind (packages/tap:i18
n-db/tap_i18n_db-server.coffee:17:35)
I20150730-21:29:37.025(2)?     at [object Object].<anonymous> (app\collections\c
ollections.js:8:31)
I20150730-21:29:37.025(2)?     at [object Object].i18n_handler (packages/tap:i18
n-db/tap_i18n_db-server.coffee:79:23)
I20150730-21:29:37.025(2)?     at [object Object]._.extend.withValue (packages/m
eteor/dynamics_nodejs.js:56:1)
I20150730-21:29:37.025(2)?     at packages/matb33:collection-hooks/collection-ho
oks.js:218:1
I20150730-21:29:37.025(2)?     at maybeAuditArgumentChecks (packages/ddp/livedat
a_server.js:1617:1)
I20150730-21:29:37.025(2)?     at [object Object]._handler (packages/matb33:coll
ection-hooks/collection-hooks.js:217:1)
I20150730-21:29:37.025(2)?     at [object Object]._.extend._startSubscription (p
ackages/ddp/livedata_server.js:769:1)
I20150730-21:29:37.025(2)?     at [object Object]._.extend._runHandler (packages
/ddp/livedata_server.js:950:1)
I20150730-21:29:37.025(2)?     at indexOf (native)

app\collections\collections.js:8:

6: if (Meteor.isServer) {
7:  TAPi18n.publish("PortfolioCategory", function() {
8:      return PortfolioCategory.i18nFind();
9:  });

Any feedback will be appreciated!

Regards

SSR

This package does not support server side rendering with flow-router-ssr (or Flow Router 4.0 that are coming) yet.

Would be awesome to support this!

Incompatibility with dburles:collection-helpers

Hi, trying to use helpers from dburles:collection-helpers and got this error:

Uncaught Error: [Can't apply helpers to 'meals' a transform function already exists!]

Any way to make them compatible?

Get translations without having to call TAPi18n.setLanguage()

Although I have no idea to do it yet, it would be nice to be able to get translations for a document without having to call TAPi18n.setLanguage().

A use case for this is the admin panel, where users will input the translations. I currently do this with tabs, switching the language on click, but as a result the whole interface switches language as well. This is not necessarily unwanted, but there’s no way to prevent it if it is. Moreover, if say you wanted to present an <input> fields for each language all in the same form, there’s no way to get the current values AFAIK besides going into the i18n property yourself.

Possible solutions (that I can think of):

  • Add a way to pass a language parameter when fetching the document
  • Have a setLanguage() method on each collection, which’ll override the global current language value
  • Add a getTranslations() method to the collection, to get a key in a defined language (I could then wrap that in a minimongoid method)

I think the last option would be the best, as it’s the only one which’ll also support the use case of displaying multiple languages at the same time.

Conflicts with package meteor-collection-helpers?

When using TAPi18n.Collection, I am unable to use my collection helpers.

Works

const Collection = new Mongo.Collection('Collection');
Collection.helpers({
  myFn() {
    ...
  },
});

Fails

const Collection = new TAPi18n.Collection('Collection');
Collection.helpers({
  myFn() {
    ...
  },
});

Error Thrown
[Can't apply helpers to 'Collection' a transform function already exists!]
see: https://github.com/dburles/meteor-collection-helpers/blob/master/collection-helpers.js#L5

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.